Company
extends BaseContent
in package
Uses
ServiceRoles, ChildAddress, Extras
Implement company object
This class provides general interfaces to handle and store companies.
Tags
Table of Contents
- $ : string|null
- $ : array<string|int, mixed>|null
- $ : string|null
- $ : array<string|int, mixed>|null
- $ : string|null
- __construct() : mixed
- Company constructor.
- Address() : Array|bool
- Get/Set address values
- AddressObject() : Address|null
- Branch() : array<string|int, mixed>|null
- Get a single branch row
- Branches() : array<string|int, mixed>|null
- List of branches
- BusinessType() : string
- The international business type
- Contacts() : array<string|int, mixed>
- CreateExtra() : Result
- Create a new extra
- DeleteExtra() : Result
- Delete the extra
- FetchExtras() : Result
- Fetch extra list
- GetDefaultLanguage() : string
- GetExtra() : Result
- Fetch single extra
- GetVisitCard() : VCard
- Create this users visit card
- HasOpen() : bool
- Has open at a certain day at a certain time frame
- IndustryBranches() : array<string|int, mixed>
- Get the branches
- LinkedEmployeeProfiles() : array<string|int, mixed>|null
- Get profiles
- LinkedEmployees() : array<string|int, User>|null
- LinkedUserAccounts() : array<string|int, mixed>|null
- Get list of assigned/responsible users
- LinkUserAccount() : mixed
- Add user with role to this entity
- Locations() : array<string|int, Address>
- Get list of index able addresses
- Logo() : Asset|null
- Get the company logo
- Name() : string|null
- Get the name
- OpeningHours() : array<string|int, mixed>
- Get opening hours
- Registration() : string|null
- Save() : mixed
- SearchFields() : array<string|int, mixed>
- Return search indexer fields
- ToPlainObject() : stdClass
- Convert to plain object
- ToPlainReducedObject() : stdClass
- UpdateAttributeServiceroles() : Result
- Callback on update validate service roles
- UpdateExtra() : Result
- Update the extra
- onSave() : void
- Trigger geocoding
- extrasPath() : string
- Helper to get the extras path
- writeExtra() : Result
- Store extras
Properties
$
public
string|null
$
name
$
public
array<string|int, mixed>|null
$
address
$
public
string|null
$
homepage
$
public
array<string|int, mixed>|null
$
serviceroles
$
public
string|null
$
timezone
Methods
__construct()
Company constructor.
public
__construct([string|null $id = null ][, string|null $language = null ]) : mixed
Parameters
- $id : string|null = null
-
A company id
- $language : string|null = null
-
The local language
Return values
mixed —Address()
Get/Set address values
public
Address([array<string|int, mixed>|null $new_value = null ]) : Array|bool
Set or get the company main address
Parameters
- $new_value : array<string|int, mixed>|null = null
-
The new value or null as getter
Return values
Array|bool —The address
AddressObject()
public
AddressObject() : Address|null
Return values
Address|null —Branch()
Get a single branch row
public
Branch(string $id) : array<string|int, mixed>|null
Parameters
- $id : string
Return values
array<string|int, mixed>|null —Branches()
List of branches
public
Branches() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —BusinessType()
The international business type
public
BusinessType() : string
Return values
string —Contacts()
public
Contacts() : array<string|int, mixed>
Return values
array<string|int, mixed> —CreateExtra()
Create a new extra
public
CreateExtra(string $type, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $type : string
- $data : array<string|int, mixed>
- $individual : bool = true
Return values
Result —DeleteExtra()
Delete the extra
public
DeleteExtra(string $type[, string|null $id = null ][, bool $individual = true ]) : Result
Parameters
- $type : string
-
The extras type
- $id : string|null = null
-
The id or null to drop all of certain kind
- $individual : bool = true
-
Is individual file or, in all full list?
Return values
Result —FetchExtras()
Fetch extra list
public
FetchExtras(string $type[, bool $individual = true ]) : Result
Parameters
- $type : string
- $individual : bool = true
Return values
Result —GetDefaultLanguage()
public
GetDefaultLanguage() : string
Return values
string —GetExtra()
Fetch single extra
public
GetExtra(string $type, string $id) : Result
Parameters
- $type : string
- $id : string
Return values
Result —GetVisitCard()
Create this users visit card
public
GetVisitCard() : VCard
Return values
VCard —HasOpen()
Has open at a certain day at a certain time frame
public
HasOpen(string $utc_time) : bool
Parameters
- $utc_time : string
Return values
bool —IndustryBranches()
Get the branches
public
IndustryBranches([string|null $l = null ]) : array<string|int, mixed>
Parameters
- $l : string|null = null
-
Target translation
Return values
array<string|int, mixed> —LinkedEmployeeProfiles()
Get profiles
public
LinkedEmployeeProfiles() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —LinkedEmployees()
public
LinkedEmployees() : array<string|int, User>|null
Return values
array<string|int, User>|null —LinkedUserAccounts()
Get list of assigned/responsible users
public
LinkedUserAccounts([array<string|int, mixed>|null $types = null ]) : array<string|int, mixed>|null
Parameters
- $types : array<string|int, mixed>|null = null
-
Roles to filter for
Return values
array<string|int, mixed>|null —LinkUserAccount()
Add user with role to this entity
public
LinkUserAccount(string $user_id, string $role) : mixed
Parameters
- $user_id : string
- $role : string
Return values
mixed —Locations()
Get list of index able addresses
public
Locations([bool $all = false ]) : array<string|int, Address>
Parameters
- $all : bool = false
Return values
array<string|int, Address> —Logo()
Get the company logo
public
Logo() : Asset|null
Return values
Asset|null —Name()
Get the name
public
Name() : string|null
Return values
string|null —OpeningHours()
Get opening hours
public
OpeningHours([string|null $l = null ]) : array<string|int, mixed>
Parameters
- $l : string|null = null
Return values
array<string|int, mixed> —Registration()
public
Registration() : string|null
Return values
string|null —Save()
public
Save([mixed $force_new_id = false ]) : mixed
Parameters
- $force_new_id : mixed = false
Return values
mixed —SearchFields()
Return search indexer fields
public
SearchFields() : array<string|int, mixed>
Convert instance to search indexer values
Return values
array<string|int, mixed> —The search indexer fields
ToPlainObject()
Convert to plain object
public
ToPlainObject([null $language = null ][, bool $with_parent = true ]) : stdClass
Parameters
- $language : null = null
- $with_parent : bool = true
Return values
stdClass —ToPlainReducedObject()
public
ToPlainReducedObject(array<string|int, mixed> $fields[, string|null $language = null ]) : stdClass
Parameters
- $fields : array<string|int, mixed>
- $language : string|null = null
Tags
Return values
stdClass —UpdateAttributeServiceroles()
Callback on update validate service roles
public
UpdateAttributeServiceroles(object $attr, array<string|int, mixed> $data) : Result
This function is called when the primary identifier is changed, is called from objecthandler->updateentity
Parameters
- $attr : object
-
The changed attribute
- $data : array<string|int, mixed>
-
The new attribute value
Return values
Result —A system result object
UpdateExtra()
Update the extra
public
UpdateExtra(string $type, string $id, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $type : string
-
The extras type
- $id : string
-
The item primary key
- $data : array<string|int, mixed>
-
The new data
- $individual : bool = true
-
Is individual file or in all full list?
Return values
Result —onSave()
Trigger geocoding
protected
onSave() : void
Return values
void —extrasPath()
Helper to get the extras path
private
extrasPath(string $type) : string
Parameters
- $type : string
Return values
string —writeExtra()
Store extras
private
writeExtra(string $file, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $file : string
-
The target file
- $data : array<string|int, mixed>
-
The new row
- $individual : bool = true
-
Save in individual file?