AccidentType
in package
The AccidentType class manages CRUD operations for accident types.
It provides methods for fetching, creating, and updating accident type records.
Table of Contents
Properties
Methods
- __construct() : mixed
- createByAdmin() : void
- Create a new accident type (admin).
- getAll() : array<int, array<string, mixed>>
- Get all accident types by status.
- getByCode() : array<string, mixed>
- Get a single accident type by its code.
- updateByCode() : void
- Update an accident type by code (admin).
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
createByAdmin()
Create a new accident type (admin).
public
createByAdmin(array<string, mixed> $data) : void
Expects in $data:
- accident_type_code (string, required)
- accident_type_name (string, required)
- sort_order (int|null)
- status (int, required)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all accident types by status.
public
getAll(array<string|int, int> $statuses) : array<int, array<string, mixed>>
Parameters
- $statuses : array<string|int, int>
-
List of allowed status values.
Return values
array<int, array<string, mixed>>getByCode()
Get a single accident type by its code.
public
getByCode(string $accidentTypeCode) : array<string, mixed>
Parameters
- $accidentTypeCode : string
Return values
array<string, mixed>updateByCode()
Update an accident type by code (admin).
public
updateByCode(array<string, mixed> $data) : void
Expects in $data:
- accident_type_code (string, required)
- accident_type_name (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>