AbstractAddonValueStorage
in package
Class AbstractAddonValueStorage
Tags
Table of Contents
- $db : CI_DB_query_builder
- $externalFields : array<string|int, mixed>
- __construct() : mixed
- AbstractAddonValueStorage Constructor
- deleteValuesByContainerId() : AbstractAddonValueStorage
- Remove addon values by the given source id.
- getValuesByContainerId() : KeyValueCollection
- Get the addon values by the given container ID.
- setValues() : AbstractAddonValueStorage
- Sets addon values to the database.
- _getContainerType() : string
- Get the container class type.
- _getExternalFieldsArray() : array<string|int, mixed>
- Should return a multidimensional array of database tables with corresponding primary keys and the column names with the corresponding key used in the KeyValueCollection which are relevant for addon values and not stored in the addon_values_storage table.
- _getExternalValuesByContainerId() : array<string|int, mixed>
- Selects the fields specified in the external fields array $this->externalFields by the given container ID and returns the associative array which will be merged with the associative array with values from the addon_values_storage table.
- _setExternalValues() : mixed
- Updates the fields specified in the external fields array $this->externalFields with the corresponding values from the provided KeyValueCollection and removes the elements from the collection before the called method writes into the addon_values_storage table.
Properties
$db
protected
CI_DB_query_builder
$db
$externalFields
protected
array<string|int, mixed>
$externalFields
= []
Methods
__construct()
AbstractAddonValueStorage Constructor
public
__construct(CI_DB_query_builder $db) : mixed
Parameters
- $db : CI_DB_query_builder
Return values
mixed —deleteValuesByContainerId()
Remove addon values by the given source id.
public
deleteValuesByContainerId(IdType $containerId) : AbstractAddonValueStorage
Parameters
- $containerId : IdType
-
Id of expected source.
Return values
AbstractAddonValueStorage —Returns the class instance.
getValuesByContainerId()
Get the addon values by the given container ID.
public
getValuesByContainerId(IdType $containerId) : KeyValueCollection
Parameters
- $containerId : IdType
-
Container database ID.
Return values
KeyValueCollection —setValues()
Sets addon values to the database.
public
setValues(IdType $containerId, KeyValueCollection $values) : AbstractAddonValueStorage
Parameters
- $containerId : IdType
-
Container database ID.
- $values : KeyValueCollection
-
KeyValueCollection which should set.
Return values
AbstractAddonValueStorage —Returns the class instance.
_getContainerType()
Get the container class type.
protected
abstract _getContainerType() : string
Return values
string —_getExternalFieldsArray()
Should return a multidimensional array of database tables with corresponding primary keys and the column names with the corresponding key used in the KeyValueCollection which are relevant for addon values and not stored in the addon_values_storage table.
protected
abstract _getExternalFieldsArray() : array<string|int, mixed>
Example: $externalFields = array(); $externalFields['orders']['primary_key'] = 'orders_id'; $externalFields['orders']['fields'] = array( 'customers_ip' => 'customerIp', 'abandonment_download' => 'downloadAbandonmentStatus', 'abandonment_service' => 'serviceAbandonmentStatus', 'cc_type' => 'ccType', 'cc_owner' => 'ccOwner', 'cc_number' => 'ccNumber', 'cc_expires' => 'ccExpires', 'cc_start' => 'ccStart', 'cc_issue' => 'ccIssue', 'cc_cvv' => 'ccCvv' );
return $externalFields;
Return values
array<string|int, mixed> —_getExternalValuesByContainerId()
Selects the fields specified in the external fields array $this->externalFields by the given container ID and returns the associative array which will be merged with the associative array with values from the addon_values_storage table.
protected
_getExternalValuesByContainerId(IdType $containerId) : array<string|int, mixed>
Parameters
- $containerId : IdType
Return values
array<string|int, mixed> —Associative array of
_setExternalValues()
Updates the fields specified in the external fields array $this->externalFields with the corresponding values from the provided KeyValueCollection and removes the elements from the collection before the called method writes into the addon_values_storage table.
protected
_setExternalValues(IdType $containerId, KeyValueCollection $values) : mixed
Parameters
- $containerId : IdType
- $values : KeyValueCollection