PHP Класс Jarves\Storage\AbstractStorage

Please do not handle 'permissionCheck' in $options. This is handled in \Jarves\Object. You will get in getList() a complex $pCondition object instead (if there are any ACL items) $pk is an array with following format array( '' => '' => ) example array( 'id' => 1234 )
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$definition Jarves\Configuration\Object Cached the object definition.
$objectKey string The current object key.
$primaryKeys array Only keys.

Открытые методы

Метод Описание
add ( array $values, array $targetPk = null, string $position = 'first', integer $scope = null ) : array
clear ( ) : boolean Do whatever is needed, to clear all items out of this object scope.
clearCache ( ) Clears the internal cache. This is called when the defined object has been changed.
configure ( string $objectKey, Object $definition ) Important call directly after the creation of this class.
drop ( ) : boolean Removes anything that is required to hold the data. E.g. SQL Tables, Drop Sequences, etc.
export ( Condition $condition = null ) : array Exports all data as array
getBranch ( array $pk = null, Condition $condition = null, integer $depth = 1, mixed $scope = null, array $options = null ) : array Returns a branch if the object is a nested set.
getBranchChildrenCount ( null $pk = null, Condition $condition = null, null $scope = null ) : array
getCount ( Condition $condition = null ) : integer
getDefinition ( )
getField ( string $fieldKey ) : array Returns a field definition.
getItem ( array $pk, array $options = null ) : array $pOptions is a array which can contain following options. All options are optional.
getItems ( array $filter = null, Condition $condition = null, array $options = null ) $pOptions is a array which can contain following options. All options are optional.
getNestedSubCondition ( Condition $condition ) : Condition Builds a condition for the sub-items check in \Jarves\Permissions::getListingCondition() for nested set objects.
getObjectKey ( ) : string Returns the object key.
getParent ( array $pk, array $options = null ) : mixed Returns the parent if exists otherwise false.
getParentId ( array $pk ) : array Returns parent's pk, if exists, otherwise null.
getParents ( array $pk ) : array Returns all parents.
getPrimaryKeys ( ) : array Returns the primary keys as array.
getRoots ( Condition $condition = null, array $options = null )
move ( array $pk, array $targetPk, string $position = 'first', $targetObjectKey = null ) : boolean Moves a item to a new position.
normalizePrimaryKey ( mixed $pk ) : array Normalizes a primary key, that is normally used inside PHP classes, since developers are lazy and we need to convert the lazy primary key to the full definition.
patch ( array $pk, array $values ) Patches a object entry. This means, only defined fields will be saved. Fields which are not defined will not be overwritten.
primaryStringToArray ( string $pk ) : array Converts given primary values from type string into proper normalized array definition.
remove ( array $pk )
search ( string $query, Condition $condition = null, integer $max = 20 ) : array | null Executes a search to this object, filter by $query and optional by a more complet condition $condition.
setDefinition ( $definition )
setPrimaryKeys ( $pks )
update ( array $pk, array $values ) Updates an object entry. This means, all fields which are not defined will be saved as NULL.

Описание методов

add() абстрактный публичный Метод

abstract public add ( array $values, array $targetPk = null, string $position = 'first', integer $scope = null ) : array
$values array
$targetPk array If nested set
$position string `first` (child), `last` (last child), `prev` (sibling), `next` (sibling)
$scope integer If nested set with scope
Результат array inserted/new primary key/s always as a array.

clear() абстрактный публичный Метод

Do whatever is needed, to clear all items out of this object scope.
abstract public clear ( ) : boolean
Результат boolean

clearCache() публичный Метод

Clears the internal cache. This is called when the defined object has been changed.
public clearCache ( )

configure() публичный Метод

Important call directly after the creation of this class.
public configure ( string $objectKey, Object $definition )
$objectKey string
$definition Object

drop() публичный Метод

Removes anything that is required to hold the data. E.g. SQL Tables, Drop Sequences, etc.
public drop ( ) : boolean
Результат boolean

export() публичный Метод

Exports all data as array
public export ( Condition $condition = null ) : array
$condition Jarves\Configuration\Condition
Результат array

getBranch() публичный Метод

Result should be: array( array(, '_children' => array(), '_childrenCount' => ), array(, '_children' => array(), '_childrenCount' => ), ... )
public getBranch ( array $pk = null, Condition $condition = null, integer $depth = 1, mixed $scope = null, array $options = null ) : array
$pk array
$condition Jarves\Configuration\Condition
$depth integer Started with one. One means, only the first level, no children at all.
$scope mixed
$options array
Результат array

getBranchChildrenCount() публичный Метод

public getBranchChildrenCount ( null $pk = null, Condition $condition = null, null $scope = null ) : array
$pk null
$condition Jarves\Configuration\Condition
$scope null
Результат array

getCount() абстрактный публичный Метод

abstract public getCount ( Condition $condition = null ) : integer
$condition Jarves\Configuration\Condition
Результат integer

getDefinition() публичный Метод

public getDefinition ( )

getField() публичный Метод

Returns a field definition.
public getField ( string $fieldKey ) : array
$fieldKey string
Результат array

getItem() абстрактный публичный Метод

'fields' Limit the columns selection. Use a array or a comma separated list (like in SQL SELECT) If empty all columns will be selected. 'permissionCheck' Defines whether we check against the ACL or not. true or false. default false
abstract public getItem ( array $pk, array $options = null ) : array
$pk array
$options array
Результат array

getItems() абстрактный публичный Метод

'fields' Limit the columns selection. Use a array or a comma separated list (like in SQL SELECT) If empty all columns will be selected. 'offset' Offset of the result set (in SQL OFFSET) 'limit' Limits the result set (in SQL LIMIT) 'order' The column to order. Example: array( array('category' => 'asc'), array(title' => 'asc') ) 'permissionCheck' Defines whether we check against the ACL or not. true or false. default false
abstract public getItems ( array $filter = null, Condition $condition = null, array $options = null )
$filter array simple filter
$condition Jarves\Configuration\Condition complex filter condition
$options array

getNestedSubCondition() публичный Метод

Builds a condition for the sub-items check in \Jarves\Permissions::getListingCondition() for nested set objects.
public getNestedSubCondition ( Condition $condition ) : Condition
$condition Jarves\Configuration\Condition
Результат Jarves\Configuration\Condition

getObjectKey() публичный Метод

Returns the object key.
public getObjectKey ( ) : string
Результат string

getParent() публичный Метод

Returns the parent if exists otherwise false.
public getParent ( array $pk, array $options = null ) : mixed
$pk array
$options array
Результат mixed

getParentId() публичный Метод

Returns parent's pk, if exists, otherwise null.
public getParentId ( array $pk ) : array
$pk array
Результат array

getParents() публичный Метод

Root object first. Each entry has to have also '_objectKey' as value.
public getParents ( array $pk ) : array
$pk array
Результат array

getPrimaryKeys() публичный Метод

Returns the primary keys as array.
public getPrimaryKeys ( ) : array
Результат array [key1, key2, key3]

getRoots() публичный Метод

public getRoots ( Condition $condition = null, array $options = null )
$condition Jarves\Configuration\Condition
$options array

move() публичный Метод

Moves a item to a new position.
public move ( array $pk, array $targetPk, string $position = 'first', $targetObjectKey = null ) : boolean
$pk array Full PK as array
$targetPk array Full PK as array
$position string `first` (child), `last` (last child), `prev` (sibling), `next` (sibling)
$targetObjectKey
Результат boolean

normalizePrimaryKey() публичный Метод

Possible input: array('bla'), 'peter', 123, Output array('id' => 'bla'), array('id' => 'peter'), array('id' => 123) if the only primary key is named id.
public normalizePrimaryKey ( mixed $pk ) : array
$pk mixed
Результат array A single primary key as array. Example: array('id' => 1).

patch() абстрактный публичный Метод

Patches a object entry. This means, only defined fields will be saved. Fields which are not defined will not be overwritten.
abstract public patch ( array $pk, array $values )
$pk array
$values array

primaryStringToArray() публичный Метод

This builds the array for the $pk for all of these methods inside this class. The primaryKey comes primarily from the REST API. admin/object/news/1 admin/objects?uri=news/1/2 where admin/object/news/ admin/objects?uri=news/ is this ID. 1/2/3 => array( array(id =>1),array(id =>2),array(id =>3) ) 1 => array(array(id => 1)) idFooBar => array( id => "idFooBar") idFoo/Bar => array(array(id => idFoo), array(id2 => "Bar")) 1,45/2,45 => array(array(id => 1, pid = 45), array(id => 2, pid=>45))
public primaryStringToArray ( string $pk ) : array
$pk string
Результат array Always a array with primary keys as arrays too. So $return[0] is the first primary key array. Example array(array('id' => 4))

remove() абстрактный публичный Метод

abstract public remove ( array $pk )
$pk array

setDefinition() публичный Метод

public setDefinition ( $definition )

setPrimaryKeys() публичный Метод

public setPrimaryKeys ( $pks )

update() абстрактный публичный Метод

Updates an object entry. This means, all fields which are not defined will be saved as NULL.
abstract public update ( array $pk, array $values )
$pk array
$values array

Описание свойств

$definition публичное свойство

Cached the object definition.
public Object,Jarves\Configuration $definition
Результат Jarves\Configuration\Object

$objectKey публичное свойство

The current object key.
public string $objectKey
Результат string

$primaryKeys публичное свойство

Only keys.
public array $primaryKeys
Результат array