xplo.re Medusa Core Framework 3.2
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
      • Driver
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Fault
      • Formatter
        • Driver
      • Incident
        • Exception
      • Reporter
        • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • Type
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Pair
  • Retained

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
Extended by Core\Set implements Core\Accessor
Extended by Core\Set\Mutable implements Core\Mutator
Extended by Core\Field implements Core\Inquiry
Extended by Core\Field\Mutable implements Core\Variator
Extended by Core\Storage\Field
Extended by Core\Storage\Field\Element
Extended by Core\Storage\Field\Element\Pair
Abstract
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
# __toString( )

Returns the value data field as a string.

Returns the value data field as a string.

Returns

string

Since

3.1

Overrides

Core\Object::__toString
public static Core\Storage_Result
# addKeyAndValue( string $key, mixed $value, array $additionalValues = null )

Inserts a new key-value pair.

Inserts a new key-value pair.

Parameters

$key
Key to insert.
$value
Value to insert.
$additionalValues
Associative array of additional values (if available at the back-end).

Returns

Core\Storage_Result

Since

3.1
public static mixed
# get( string $key )

Retrieves the value for a given key.

Retrieves the value for a given key.

Parameters

$key
Key to retrieve value for.

Returns

mixed
Value retrieved from storage or null if no such key exists.

Since

3.1

Overrides

Core\Storage\Field\Element::get
public static mixed
# getSerialized( string $key )

Retrieves a previously serialised value for a given key.

Retrieves a previously serialised value for a given key.

Parameters

$key
Key to retrieve value for.

Returns

mixed

De-serialised value retrieved from storage or null if no such key exists or de-serialisation failed.

Since

3.1
public static Core\Type\ImmutableString
# getStringObject( string $key )

Retrieves a string object for a given key.

Retrieves a string object for a given key.

Parameters

$key
Key to retrieve string object for.

Returns

Core\Type\ImmutableString
String object created from value retrieved from storage.

Since

3.1
public static Core\Value
# getValue( string $key )

Retrieves a value object for a given key.

Retrieves a value object for a given key.

Parameters

$key
Key to retrieve value object for.

Returns

Core\Value
Value object created from value retrieved from storage.

Since

3.1
public static Core\Storage_Result
# set( string $key, mixed $value )

Sets a value for a given key. If no such key exists, a new entry is automatically created.

Sets a value for a given key. If no such key exists, a new entry is automatically created.

Parameters

$key
Key to insert or update value for.
$value
Value to insert or overwrite existing value with.

Returns

Core\Storage_Result

Since

3.1
public static Core\Storage_Result
# setSerialized( string $key, mixed $value )

Sets the serialised value for a given key. If no such key exist, a new entry is automatically created.

Sets the serialised value for a given key. If no such key exist, a new entry is automatically created.

Parameters

$key
Key to insert or update serialised value for.
$value
Value to serialise and insert or overwrite existing value with.

Returns

Core\Storage_Result

Since

3.1
public Core\Storage_Result
# updateValue( mixed $value, array $additionalValues = null )

Updates value and optionally the additional values set.

Updates value and optionally the additional values set.

Parameters

$value
New value to set.
$additionalValues

Associative key-value array of additional values to set (for the same storage row).

Returns

Core\Storage_Result

Remark

Changes to the element identifier Core\Storage\Field\Element::KeyName are silently discarded.

Since

3.1
public static Core\Storage_Result
# updateValueForKey( string $key, mixed $value, array $additionalValues )

Updates value for a given key and optionally update additional values set.

Updates value for a given key and optionally update additional values set.

Parameters

$key
Key to set values for.
$value
New value to set.
$additionalValues

Associative key-value array of additional values to set (for the same storage row).

Returns

Core\Storage_Result

Remark

Changes to the element identifier Core\Storage\Field\Element::KeyName are silently discarded.

Since

3.1

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

__set(), __unset()

Methods inherited from Core\Set

__get(), __isset()

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.

Name of default value field.

Remark

A derived class should overwrite this value with the index name of the data value, if different from "value".


Since

3.1
# 'value'

Constants inherited from Core\Storage\Field\Element

KeyName, ReferenceName, StorageName

Constants inherited from Core\Storage\Field

FullCache, IncrementalCache, NoCache

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

Properties inherited from Core\Field\Mutable

$_v_masqueradedKeys

Properties inherited from Core\Field

$_v_data

Magic properties inherited from Core\Storage\Field

$cacheMode, $conditional, $driver, $reference, $virtualData

Magic properties inherited from Core\Field\Mutable

$masqueradedKeys

Magic properties inherited from Core\Field

$data

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.2 API documentation generated by ApiGen