A ORM data source driver which only works against native PHP data structures to support its interface. More...
Public Member Functions | |
__construct ($storage=array(), $mockfile=null, $mockdriver=null) | |
Constructor for this class. | |
count ($table, $structure, $filter) | |
Get the number of objects in a table that matches a given filter. | |
it ($table, $structure, $filter, $columns, $order=array(), $limit=false, $offset=false) | |
Get the objects in a table that matches a given filter. | |
stats ($table, $structure, $filter, $intersections) | |
Returns an arbitrary (driver-specific) status summary of this table. | |
update ($table, $structure, $filter, $values) | |
Update one or more objects in a table matching a filter with a given set of values. | |
delete ($table, $structure, $filter) | |
Delete objects matching a given filter from a table. | |
insert_single ($table, $structure, $values) | |
Insert an object into a specified table. | |
Protected Member Functions | |
persist ($table) | |
Writes application inserted mocked data back into the mock file, so that it is available on subsequent requests. | |
Protected Attributes | |
$storage = array() | |
Temporary data storage. | |
$mockfile = null | |
The file the data is mocked into. | |
$mockdriver = null | |
The driver being mocked. |
A ORM data source driver which only works against native PHP data structures to support its interface.
Useful for mocking!
ORMDriverNative::__construct | ( | $ | storage = array() , |
|
$ | mockfile = null , |
|||
$ | mockdriver = null | |||
) |
Constructor for this class.
$storage | array An associative array over the table space that this driver serves | |
$mockfile | string Path to the mock datafile | |
$mockdriver | string Named of the mocked driver |
ORMDriverNativeException | when $storage is not good set of tables |
ORMDriverNative::count | ( | $ | table, | |
$ | structure, | |||
$ | filter | |||
) |
Get the number of objects in a table that matches a given filter.
$table | string The table to perform the count on | |
$structure | array An associative array describing this table | |
$filter | LivestatusFilterBase The filter |
Implements ORMDriverInterface.
Reimplemented in ORMDriverYAML.
ORMDriverNative::delete | ( | $ | table, | |
$ | structure, | |||
$ | filter | |||
) |
Delete objects matching a given filter from a table.
$table | string The table to delete from | |
$structure | array An associative array describing this table | |
$filter | LivestatusFilterBase The filter |
Implements ORMDriverInterface.
Reimplemented in ORMDriverYAML.
ORMDriverNative::insert_single | ( | $ | table, | |
$ | structure, | |||
$ | values | |||
) |
Insert an object into a specified table.
$table | string The table to insert the object into | |
$structure | array An associative array describing this table | |
$values | array A mapping from fields to values |
If the orm structure has only one key and that key is an integer in the structure, find the max of that key and increment by one.
Implements ORMDriverInterface.
Reimplemented in ORMDriverYAML.
ORMDriverNative::it | ( | $ | table, | |
$ | structure, | |||
$ | filter, | |||
$ | columns, | |||
$ | order = array() , |
|||
$ | limit = false , |
|||
$ | offset = false | |||
) |
Get the objects in a table that matches a given filter.
$table | string The table to perform the query on | |
$structure | array An associative array describing this table | |
$filter | LivestatusFilterBase The filter | |
$columns | array An array of strings denoting the columns to expose in the iterator | |
$order | array An array of strings denoting the columns to order by in the format "<column [asc|desc]>" | |
$limit | int Upper bound on the number of objects in the returned iterator | |
$offset | int Specifies the offset |
Implements ORMDriverInterface.
Reimplemented in ORMDriverYAML.
ORMDriverNative::persist | ( | $ | table | ) | [protected] |
Writes application inserted mocked data back into the mock file, so that it is available on subsequent requests.
$table | string |
ORMDriverNative::stats | ( | $ | table, | |
$ | structure, | |||
$ | filter, | |||
$ | intersections | |||
) |
Returns an arbitrary (driver-specific) status summary of this table.
$table | string The table | |
$structure | array An associative array describing this table | |
$filter | LivestatusFilterBase The filter | |
$intersections | mixed |
Implements ORMDriverInterface.
ORMDriverNative::update | ( | $ | table, | |
$ | structure, | |||
$ | filter, | |||
$ | values | |||
) |
Update one or more objects in a table matching a filter with a given set of values.
$table | string The table to update | |
$structure | array An associative array describing this table | |
$filter | LivestatusFilterBase The filter | |
$values | array A mapping from fields to values |
Implements ORMDriverInterface.
Reimplemented in ORMDriverYAML.