Hierarchy
in package
Class Hierarchy
This class provides methods for managing hierarchy records in a database, including retrieving, creating, and updating hierarchies. It is designed to interact with the MySql abstraction layer for database operations.
Table of Contents
Properties
Methods
- __construct() : mixed
- createByAdmin() : void
- Create a new hierarchy (admin).
- getAll() : array<int, array<string, mixed>>
- Get all hierarchies for given statuses.
- getByCode() : array<string, mixed>
- Get a single hierarchy by its code.
- updateByCode() : void
- Update a hierarchy by its code (admin).
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
createByAdmin()
Create a new hierarchy (admin).
public
createByAdmin(array<string, mixed> $data) : void
Expects in $data:
- hierarchy_code (string, required)
- hierarchy_name (string, required)
- hierarchy_name_display (string, required)
- reference_code (string|null)
- sort_order (int|null)
- status (int, required)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all hierarchies for given statuses.
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 hierarchy by its code.
public
getByCode(string $hierarchyCode) : array<string, mixed>
Parameters
- $hierarchyCode : string
Return values
array<string, mixed>updateByCode()
Update a hierarchy by its code (admin).
public
updateByCode(array<string, mixed> $data) : void
Expects in $data:
- hierarchy_code (string, required)
- hierarchy_name (string|null)
- hierarchy_name_display (string|null)
- reference_code (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>