SettingsCollection extends Component
A collection manager of company settings
Table of Contents
Properties
| $components | |
| $helpers | |
| $models |
Methods
| __construct() | Initialize the SettingsCollection |
| fetchClientGroupSetting() | Fetches a specific ClientGroup setting. |
| fetchClientGroupSettings() | Fetches all client group settings for a particular group |
| fetchClientSetting() | Fetches a specific Client setting. |
| fetchClientSettings() | Fetches all client settings for a particular client |
| fetchSetting() | Fetches a specific setting that apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item. |
| fetchSettings() | Fetches all settings that apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item. |
| fetchSystemSetting() | Fetches a specific system setting. |
| fetchSystemSettings() | Fetches all system settings. |
| loadIfNotSet() | Loads the given model if nothing passed into $obj |
Methods
__construct()
Initialize the SettingsCollection
public
__construct() : mixed
fetchClientGroupSetting()
Fetches a specific ClientGroup setting.
public
fetchClientGroupSetting(int $client_group_id[, ClientGroups $settings = null ][, string $key = null ]) : array<string|int, mixed>
Parameters
- $client_group_id : int
-
The client group ID to fetch a setting for
- $settings : ClientGroups = null
-
A reference to the ClientGroups model object
- $key : string = null
-
The key name of the setting to fetch
Return values
array<string|int, mixed> —containing the key and value for this setting
fetchClientGroupSettings()
Fetches all client group settings for a particular group
public
fetchClientGroupSettings(int $client_group_id[, ClientGroups $settings = null ][, bool $ignore_inheritence = false ]) : array<string|int, mixed>
Parameters
- $client_group_id : int
-
The client group ID to fetch settings for
- $settings : ClientGroups = null
-
A reference to the ClientGroups model object
- $ignore_inheritence : bool = false
-
True to fetch only client group settings without inheriting from company or system settings (default false)
Return values
array<string|int, mixed> —A key=>value array of client group settings
fetchClientSetting()
Fetches a specific Client setting.
public
fetchClientSetting(int $client_id[, Clients $settings = null ][, string $key = null ]) : array<string|int, mixed>
Parameters
- $client_id : int
-
The client group ID to fetch a setting for
- $settings : Clients = null
-
A reference to the Clients model object
- $key : string = null
-
The key name of the setting to fetch
Return values
array<string|int, mixed> —containing the key and value for this setting
fetchClientSettings()
Fetches all client settings for a particular client
public
fetchClientSettings(int $client_id[, Clients $settings = null ]) : array<string|int, mixed>
Parameters
- $client_id : int
-
The client ID to fetch settings for
- $settings : Clients = null
-
A reference to the Clients model object
Return values
array<string|int, mixed> —A key=>value array of client group settings
fetchSetting()
Fetches a specific setting that apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.
public
fetchSetting([Companies $companies = null ][, int $company_id = null ][, string $key = null ]) : array<string|int, mixed>
Parameters
- $companies : Companies = null
-
The Companies object model (optional)
- $company_id : int = null
-
The company ID to retrieve a setting for (optional)
- $key : string = null
-
The key name of the setting to fetch (optional)
Return values
array<string|int, mixed> —containing the key and value for this setting
fetchSettings()
Fetches all settings that apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.
public
fetchSettings([Companies $companies = null ][, int $company_id = null ][, bool $ignore_inheritence = false ]) : array<string|int, mixed>
Parameters
- $companies : Companies = null
-
A reference to the Companies model object
- $company_id : int = null
-
The company ID to retrieve settings for
- $ignore_inheritence : bool = false
-
True to only retrieve company settings, false to get all inherited settings (default false)
Return values
array<string|int, mixed> —A key=>value array of company settings
fetchSystemSetting()
Fetches a specific system setting.
public
fetchSystemSetting([Settings $settings = null ][, string $key = null ]) : array<string|int, mixed>
Parameters
- $settings : Settings = null
-
A reference to the Settings model object
- $key : string = null
-
The key name of the setting to fetch
Return values
array<string|int, mixed> —containing the key and value for this setting
fetchSystemSettings()
Fetches all system settings.
public
fetchSystemSettings([Settings $settings = null ]) : array<string|int, mixed>
Parameters
- $settings : Settings = null
-
A reference to the Settings model object
Return values
array<string|int, mixed> —A key=>value array of system settings
loadIfNotSet()
Loads the given model if nothing passed into $obj
private
loadIfNotSet(mixed $obj, string $model) : object
Parameters
- $obj : mixed
-
The model object to be used, null to initialize the model using $model instead.
- $model : string
-
The name of the model to initialize if $obj is not given
Return values
object —The model object specified by $obj or created using $model if not specified.