PHP Class lithium\data\source\mongo_db\Exporter

Inheritance: extends lithium\core\StaticObject
Datei anzeigen Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Property Type Description
$_classes
$_commands

Public Methods

Method Description
get ( $type, $export, array $options = [] )
toCommand ( $changes )

Protected Methods

Method Description
_append ( array $changes, string $key, mixed $value, string $change ) : array Handles appending nested objects to document changesets.
_create ( $export, array $options )
_diff ( array $left, array $right ) : array Handle diffing operations between Document object states. Implemented because all of PHP's array comparison functions are broken when working with objects.
_update ( array $export ) : array Calculates changesets for update operations, and produces an array which can be converted to a set of native MongoDB update operations.

Method Details

_append() protected static method

Handles appending nested objects to document changesets.
protected static _append ( array $changes, string $key, mixed $value, string $change ) : array
$changes array The full set of changes to be made to the database.
$key string The key of the field to append, which may be a dot-separated path if the value is or is contained within a nested object.
$value mixed The value to append to the changeset. Can be a scalar value, array, a nested object, or part of a nested object.
$change string The type of change, as to whether update/remove or rename etc.
return array Returns the value of `$changes`, with any new changed values appended.

_create() protected static method

protected static _create ( $export, array $options )
$options array

_diff() protected static method

Handle diffing operations between Document object states. Implemented because all of PHP's array comparison functions are broken when working with objects.
protected static _diff ( array $left, array $right ) : array
$left array The left-hand comparison array.
$right array The right-hand comparison array.
return array Returns an array of the differences of `$left` compared to `$right`.

_update() protected static method

Calculates changesets for update operations, and produces an array which can be converted to a set of native MongoDB update operations.
protected static _update ( array $export ) : array
$export array An array of fields exported from a call to `Document::export()`, and should contain the following keys: - `'data'` _array_: An array representing the original data loaded from the database for the document. - `'update'` _array_: An array representing the current state of the document, containing any modifications made. - `'key'` _string_: If this is a nested document, this is a dot-separated path from the root-level document.
return array Returns an array representing the changes to be made to the document. These are converted to database-native commands by the `toCommand()` method.

get() public static method

public static get ( $type, $export, array $options = [] )
$options array

toCommand() public static method

public static toCommand ( $changes )

Property Details

$_classes protected_oe static_oe property

protected static $_classes

$_commands protected_oe static_oe property

protected static $_commands