PHP Class 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 )
Afficher le fichier Open project: jarves/jarves Class Usage Examples

Méthodes publiques

Свойство Type Description
$definition Jarves\Configuration\Object Cached the object definition.
$objectKey string The current object key.
$primaryKeys array Only keys.

Méthodes publiques

Méthode Description
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.

Method Details

add() abstract public méthode

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
Résultat array inserted/new primary key/s always as a array.

clear() abstract public méthode

Do whatever is needed, to clear all items out of this object scope.
abstract public clear ( ) : boolean
Résultat boolean

clearCache() public méthode

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

configure() public méthode

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

drop() public méthode

Removes anything that is required to hold the data. E.g. SQL Tables, Drop Sequences, etc.
public drop ( ) : boolean
Résultat boolean

export() public méthode

Exports all data as array
public export ( Condition $condition = null ) : array
$condition Jarves\Configuration\Condition
Résultat array

getBranch() public méthode

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
Résultat array

getBranchChildrenCount() public méthode

public getBranchChildrenCount ( null $pk = null, Condition $condition = null, null $scope = null ) : array
$pk null
$condition Jarves\Configuration\Condition
$scope null
Résultat array

getCount() abstract public méthode

abstract public getCount ( Condition $condition = null ) : integer
$condition Jarves\Configuration\Condition
Résultat integer

getDefinition() public méthode

public getDefinition ( )

getField() public méthode

Returns a field definition.
public getField ( string $fieldKey ) : array
$fieldKey string
Résultat array

getItem() abstract public méthode

'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
Résultat array

getItems() abstract public méthode

'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() public méthode

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
Résultat Jarves\Configuration\Condition

getObjectKey() public méthode

Returns the object key.
public getObjectKey ( ) : string
Résultat string

getParent() public méthode

Returns the parent if exists otherwise false.
public getParent ( array $pk, array $options = null ) : mixed
$pk array
$options array
Résultat mixed

getParentId() public méthode

Returns parent's pk, if exists, otherwise null.
public getParentId ( array $pk ) : array
$pk array
Résultat array

getParents() public méthode

Root object first. Each entry has to have also '_objectKey' as value.
public getParents ( array $pk ) : array
$pk array
Résultat array

getPrimaryKeys() public méthode

Returns the primary keys as array.
public getPrimaryKeys ( ) : array
Résultat array [key1, key2, key3]

getRoots() public méthode

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

move() public méthode

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
Résultat boolean

normalizePrimaryKey() public méthode

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
Résultat array A single primary key as array. Example: array('id' => 1).

patch() abstract public méthode

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() public méthode

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
Résultat 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 méthode

abstract public remove ( array $pk )
$pk array

setDefinition() public méthode

public setDefinition ( $definition )

setPrimaryKeys() public méthode

public setPrimaryKeys ( $pks )

update() abstract public méthode

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

Property Details

$definition public_oe property

Cached the object definition.
public Object,Jarves\Configuration $definition
Résultat Jarves\Configuration\Object

$objectKey public_oe property

The current object key.
public string $objectKey
Résultat string

$primaryKeys public_oe property

Only keys.
public array $primaryKeys
Résultat array