CompanyLegalEntity
in package
Class for managing company legal entities, including fetching, creating, updating, and retrieving entities based on division or company codes.
Table of Contents
Properties
Methods
- __construct() : mixed
- create() : array<string, mixed>|false
- Create a legal entity under a division (non-admin helper).
- createByAdmin() : void
- Create a legal entity (admin).
- getAll() : array<int, array<string, mixed>>
- Get all legal entities for given statuses.
- getAllforCompany() : array<int, array<string, mixed>>
- Get all legal entities for a company (via divisions).
- getAllforDivision() : array<int, array<string, mixed>>
- Get all legal entities for a division.
- getByCode() : array<string, mixed>
- Get a legal entity by code.
- listCodesForCompany() : array<int, string>
- List all legal-entity codes for a company.
- suggestNextCode() : array{prefix: string, pad: int, code: string}
- Suggest next legal entity code by prefix, optionally within a division.
- updateByCode() : void
- Update legal entity by code (admin).
- updateName() : bool
- Update legal entity name/display by code.
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
create()
Create a legal entity under a division (non-admin helper).
public
create(string $divisionCode, string $legalEntityCode, string $legalEntityName, string $display[, int $status = 1 ][, string $user = 'admin' ]) : array<string, mixed>|false
Parameters
- $divisionCode : string
- $legalEntityCode : string
- $legalEntityName : string
- $display : string
- $status : int = 1
- $user : string = 'admin'
Return values
array<string, mixed>|falsecreateByAdmin()
Create a legal entity (admin).
public
createByAdmin(array<string, mixed> $data) : void
Expects in $data:
- company_legal_entity_code (string, required)
- company_legal_entity_name (string, required)
- company_legal_entity_display (string, required)
- company_division_code (string, required, FK by code)
- sort_order (int|null)
- status (int, required)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all legal entities 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>>getAllforCompany()
Get all legal entities for a company (via divisions).
public
getAllforCompany(string $companyCode) : array<int, array<string, mixed>>
Parameters
- $companyCode : string
Return values
array<int, array<string, mixed>>getAllforDivision()
Get all legal entities for a division.
public
getAllforDivision(string $divisionCode) : array<int, array<string, mixed>>
Parameters
- $divisionCode : string
Return values
array<int, array<string, mixed>>getByCode()
Get a legal entity by code.
public
getByCode(string $legalEntityCode) : array<string, mixed>
Parameters
- $legalEntityCode : string
Return values
array<string, mixed>listCodesForCompany()
List all legal-entity codes for a company.
public
listCodesForCompany(string $companyCode) : array<int, string>
Parameters
- $companyCode : string
Return values
array<int, string>suggestNextCode()
Suggest next legal entity code by prefix, optionally within a division.
public
suggestNextCode([string|null $divisionCode = null ][, string $prefix = 'CLE-' ][, int $pad = 6 ]) : array{prefix: string, pad: int, code: string}
Parameters
- $divisionCode : string|null = null
- $prefix : string = 'CLE-'
- $pad : int = 6
Return values
array{prefix: string, pad: int, code: string}updateByCode()
Update legal entity by code (admin).
public
updateByCode(array<string, mixed> $data) : void
Expects in $data:
- company_legal_entity_code (string, required)
- company_legal_entity_name (string|null)
- company_legal_entity_display (string|null)
- company_division_code (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
updateName()
Update legal entity name/display by code.
public
updateName(array<string, mixed> $data) : bool
Parameters
- $data : array<string, mixed>