Class Pair
Used to store key-value pairs with support for extended attributes. The class is usually used for a global key-value registry with storage support, e.g. application settings.
Usage
An implementation needs to create an own subclass and must initialise the key, value, reference and storage name properties to valid values. The key and value properties denote the key and default value columns used as data pairings.
use Core\Storage; class DynamicSettings extends Storage\Field\Element\Pair { const KeyName = 'Key'; const ValueName = 'Value'; const ReferenceName = 'SettingsTable'; const StorageName = 'dbInstance'; // Uses Registry::instance()->dbInstance; }
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Set\Mutable implements Core\Mutator
- Core\Field implements Core\Inquiry
- Core\Field\Mutable implements Core\Variator
- Core\Storage\Field
- Core\Storage\Field\Element
- Core\Storage\Field\Element\Pair
Namespace: Core\Storage\Field\Element
Package: Core\Storage
Since: 3.1
Requires: PHP 5.3
Version: 1.1
Located at Storage/Field/Element/Pair.inc.php
Methods summary
public
string
|
|
public static
|
#
addKeyAndValue( string $key, mixed $value, array $additionalValues = null )
Inserts a new key-value pair. |
public static
mixed
|
|
public static
mixed
|
|
public static
|
|
public static
|
|
public static
|
#
set( string $key, mixed $value )
Sets a value for a given key. If no such key exists, a new entry is automatically created. |
public static
|
#
setSerialized( string $key, mixed $value )
Sets the serialised value for a given key. If no such key exist, a new entry is automatically created. |
public
|
#
updateValue( mixed $value, array $additionalValues = null )
Updates value and optionally the additional values set. |
public static
|
#
updateValueForKey( string $key, mixed $value, array $additionalValues )
Updates value for a given key and optionally update additional values set. |
Methods inherited from Core\Storage\Field\Element
__construct()
,
add()
,
driver()
,
erase()
,
eraseID()
,
update()
,
updateID()
Methods inherited from Core\Storage\Field
cache()
,
getDataForUndefinedKey()
,
setCacheMode()
,
setDataForKey()
,
setDataForUndefinedKey()
Methods inherited from Core\Field\Mutable
offsetSet()
,
offsetUnset()
,
setDataForKeys()
,
setKeyMasquerade()
,
updateMasqueradedKeys()
Methods inherited from Core\Field
getDataForKey()
,
getDataForKeys()
,
issetDataForKey()
,
offsetExists()
,
offsetGet()
Methods inherited from Core\Set\Mutable
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
ValueName
Name of default value field. |
#
'value'
|
Constants inherited from Core\Storage\Field\Element
Constants inherited from Core\Storage\Field
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
Properties inherited from Core\Storage\Field
$_v_cacheMode
,
$_v_conditional
,
$_v_driver
,
$_v_reference
,
$_v_virtualData