ReferenceCompany
in package
Class ReferenceCompany
This class provides methods for managing and querying the relationship between references and companies. It includes functionality for retrieving, saving, and deleting reference-company assignments, as well as listing options based on assignment status.
Table of Contents
Properties
Methods
- __construct() : mixed
- deleteAssignment() : void
- Soft delete a company ↔ reference assignment (status = 9).
- getAll() : array<int, array<string, mixed>>
- Get all reference-company pairs filtered by status.
- getByCode() : array<string, mixed>
- Get a single reference-company relation by both codes.
- listOptions() : array<string|int, mixed>
- For a company, return its code and a list of all active reference_codes that are linked to it (reference_company.status = 1, reference.status IN $statuses).
- saveAssignment() : void
- Create or reactivate a company ↔ reference assignment.
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
deleteAssignment()
Soft delete a company ↔ reference assignment (status = 9).
public
deleteAssignment(array<string, mixed> $data) : void
Expects in $data:
- company_code (string, required)
- reference_code (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all reference-company pairs 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 reference-company relation by both codes.
public
getByCode(string $referenceCode, string $companyCode) : array<string, mixed>
Parameters
- $referenceCode : string
- $companyCode : string
Return values
array<string, mixed>listOptions()
For a company, return its code and a list of all active reference_codes that are linked to it (reference_company.status = 1, reference.status IN $statuses).
public
listOptions(string $companyCode, array<string|int, int> $statuses) : array<string|int, mixed>
Parameters
- $companyCode : string
- $statuses : array<string|int, int>
-
Status values for the reference table (e.g. [1])
Return values
array<string|int, mixed>saveAssignment()
Create or reactivate a company ↔ reference assignment.
public
saveAssignment(array<string, mixed> $data) : void
Expects in $data:
- company_code (string, required)
- reference_code (string, required)
- sort_order (int|null)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>