CompanyUnit
in package
Manages operations related to the assignment of units to companies, including listing, creating, updating, and soft-deleting associations between companies and units.
Table of Contents
Properties
Methods
- __construct() : mixed
- deleteAssignment() : void
- Soft-delete a company ↔ unit assignment (status = 9).
- listOptions() : array{company_code: string, checked_units: string[]}
- List all unit codes linked to a company.
- saveAssignment() : void
- Create or reactivate a company ↔ unit assignment.
Properties
$db
protected
MySql
$db
Methods
__construct()
public
__construct(MySql $db) : mixed
Parameters
- $db : MySql
deleteAssignment()
Soft-delete a company ↔ unit assignment (status = 9).
public
deleteAssignment(array<string, mixed> $data) : void
Expects in $data:
- company_code (string, required)
- unit_code (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
listOptions()
List all unit codes linked to a company.
public
listOptions(string $companyCode, array<string|int, int> $statuses) : array{company_code: string, checked_units: string[]}
Parameters
- $companyCode : string
- $statuses : array<string|int, int>
Return values
array{company_code: string, checked_units: string[]}saveAssignment()
Create or reactivate a company ↔ unit assignment.
public
saveAssignment(array<string, mixed> $data) : void
Expects in $data:
- company_code (string, required)
- unit_code (string, required)
- sort_order (int|null)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>