TimePeriod
in package
Class TimePeriod
Provides methods to manage and retrieve time period data from the database, including retrieving time periods by code, filtering by status, and managing time periods in an admin context (create/update).
Table of Contents
Properties
Methods
- __construct() : mixed
- createByAdmin() : void
- Create a new time period (admin).
- getAll() : array<int, array<string, mixed>>
- Get all time periods filtered by status.
- getByCode() : array<string, mixed>
- Get a single time period by its code.
- updateByCode() : void
- Update a time period by its code (admin).
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
createByAdmin()
Create a new time period (admin).
public
createByAdmin(array<string, mixed> $data) : void
Expects in $data:
- time_period_code (string, required)
- time_period_name (string, required)
- sort_order (int|null)
- status (int, required; default 1)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all time periods filtered by status.
public
getAll(array<string|int, int> $statuses) : array<int, array<string, mixed>>
Parameters
- $statuses : array<string|int, int>
Return values
array<int, array<string, mixed>>getByCode()
Get a single time period by its code.
public
getByCode(string $code) : array<string, mixed>
Parameters
- $code : string
Return values
array<string, mixed>updateByCode()
Update a time period by its code (admin).
public
updateByCode(array<string, mixed> $data) : void
Expects in $data:
- time_period_code (string, required)
- time_period_name (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>