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

  • Accessor
  • Accessor_Alias
  • Accessor_BitwiseAND
  • Accessor_BitwiseOR
  • Accessor_BitwiseXOR
  • Accessor_Call
  • Accessor_Conditional
  • Accessor_Conditionals
  • Accessor_Conjunction
  • Accessor_Count
  • Accessor_Disjunction
  • Accessor_Eq
  • Accessor_Eraser
  • Accessor_Expressions
  • Accessor_Grouping
  • Accessor_GT
  • Accessor_GTE
  • Accessor_Insert
  • Accessor_Join
  • Accessor_JoinConditional
  • Accessor_Key
  • Accessor_Limit
  • Accessor_List
  • Accessor_LT
  • Accessor_LTE
  • Accessor_Match
  • Accessor_NEq
  • Accessor_Node
  • Accessor_Not
  • Accessor_Now
  • Accessor_Ordering
  • Accessor_Parameter
  • Accessor_Reference
  • Accessor_Regexp
  • Accessor_Reverse
  • Accessor_Selector
  • Accessor_Similarity
  • Accessor_Update
  • Accessor_Value
  • Accessor_Values
  • Accessor_Wildcard
  • Field
  • SQL_Result
  • SQL_Statement

Class Field

Mutable storage field interface with optional data cache support. Derived classes may implement get* and set* methods to perform specialised data transformations.

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

Direct known subclasses

Core\Storage\Field\Aggregate, Core\Storage\Field\Element

Indirect known subclasses

Core\Storage\Field\Element\Pair, Core\Storage\Field\Element\Retained

Namespace: Core\Storage
Package: Core\Storage
Since: 3.0
Requires: PHP 5.3
Version: 1.1
Located at Storage/Field.inc.php

Methods summary

public
# __construct( Core\Storage $driver, Core\Storage\Accessor_Reference $reference, Core\Storage\Accessor_Conditionals $conditional )

Parameters

$driver
Storage back-end driver.
$reference
Storage reference pointing to the data source / target.
$conditional

Storage conditional node to match the storage entry that is represented by the storage field. At least a key equality operator is required, complex conditionals are also supported.

Remark

Derived classes should initialise cached contents in their constructor.

Since

3.0
public boolean
# cache( array $keys )

Caches a copy of values from the storage back-end.

Caches a copy of values from the storage back-end.

Parameters

$keys

Array of keys to cache the corresponding value for. Values are retrieved from the storage back-end.

Returns

boolean
true on success, otherwise an exception is thrown.

Since

3.0
public mixed
# getDataForUndefinedKey( string $key )

Fetches a value from the storage back-end (ignoring the cache).

Fetches a value from the storage back-end (ignoring the cache).

Parameters

$key
Key to retrieve value for.

Returns

mixed
Retrieved value from storage back-end.

Throws

Core\Exception\UndefinedKey
Failed to resolve data field for the given key.

Remark

If full cache mode is set, the whole data cache is refreshed.

Since

3.0

Overrides

Core\Field::getDataForUndefinedKey
public
# setCacheMode( integer $mode )

Changes the cache mode.

Changes the cache mode.

Parameters

$mode
New cache mode to set.

Returns


$this

Throws

Core\Exception\InvalidArgument
Unknown or invalid cache mode value.

Since

3.0
public true
# setDataForKey( string $key, mixed $value )

Updates a value directly on the storage back-end. The internally cached value (if caching is used) is updated as well.

Updates a value directly on the storage back-end. The internally cached value (if caching is used) is updated as well.

Parameters

$key
Key to update value for.
$value
New value for given key.

Returns

true

Since

3.0

Overrides

Core\Field\Mutable::setDataForKey
public mixed
# setDataForUndefinedKey( string $key, mixed $value )

Updates a value directly on the storage back-end. The internally cached value (if caching is used) is updated as well. Does not invoke any write method.

Updates a value directly on the storage back-end. The internally cached value (if caching is used) is updated as well. Does not invoke any write method.

Parameters

$key
Key to update value for.
$value
New value for given key.

Returns

mixed
The return value depends on the reimplementation.

Throws

Core\Exception\UndefinedKey
No data field identified by the given key exists.

Since

3.0

Overrides

Core\Field\Mutable::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(), __toString(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

integer NoCache

Cache mode that does not cache any value retrieved from the storage back-end. Fields are on request always fetched directly from the back-end.

Cache mode that does not cache any value retrieved from the storage back-end. Fields are on request always fetched directly from the back-end.

Since

3.0
# 0
integer IncrementalCache

Cache mode that automatically caches all values once they were retrieved from the back-end.

Cache mode that automatically caches all values once they were retrieved from the back-end.

Since

3.0
# 1
integer FullCache

Cache mode that initially retrieves and cache all values from the back-end on first request.

Cache mode that initially retrieves and cache all values from the back-end on first request.

Since

3.0
# 2

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected integer $_v_cacheMode

Currently set cache mode.

Currently set cache mode.

Since

3.0
# self::NoCache
protected Core\Storage\Accessor_Conditional $_v_conditional

Pre-configured conditional to match the storage entry of the field instance.

Pre-configured conditional to match the storage entry of the field instance.

Since

3.0
#
protected Core\Storage $_v_driver

Storage driver.

Storage driver.

Since

3.0
#
protected Core\Storage\Accessor_Reference $_v_reference

Reference that contains the field data.

Reference that contains the field data.

Since

3.0
#
protected $_v_virtualData

Associative array of virtual data fields. Array keys designate the name of a virtual data field, the value is an array of transformation callbacks to construct accessor nodes for retrieving and setting the virtual data key.

Associative array of virtual data fields. Array keys designate the name of a virtual data field, the value is an array of transformation callbacks to construct accessor nodes for retrieving and setting the virtual data key.

Virtual data keys take precedence over native data keys; that is, a virtual data key with the same name as a native data key overwrite the value of the native data key. As a side effect, the native data key can no longer be accessed.

On the other hand, KDC methods always take precedence over data fields, hence Storage-based data transformation should be implemented as virtual data fields, pre- and post-transformations as KDC methods.

Since

3.1
#

Properties inherited from Core\Field\Mutable

$_v_masqueradedKeys

Properties inherited from Core\Field

$_v_data

Magic properties

public read-only integer $cacheMode

Currently set cache mode.

public read-only Core\Storage\Accessor_Conditional $conditional

Conditional to identify the storage entry represented by this field.

public read-only Core\Storage $driver

Storage driver.

public read-only Core\Storage\Accessor_Reference $reference

Reference that contains the field data.

public read-only array $virtualData

Associative array of virtual data fields.

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