PHP Class Jarves\Objects

Afficher le fichier Open project: jarves/jarves Class Usage Examples

Méthodes publiques

Свойство Type Description
$instances array Array of instances of the object classes

Protected Properties

Свойство Type Description
$jarves Jarves

Méthodes publiques

Méthode Description
__construct ( Jarves $jarves, Symfony\Component\DependencyInjection\ContainerInterface $container )
add ( string $objectKey, array $values, mixed $targetPk = null, string $position = 'first', boolean $targetObjectKey = null, array $options = [] ) : mixed Adds a item.
checkField ( string $objectKey, string $field ) : boolean Checks if a field in a object exists.
cleanup ( ) Clears the instances cache.
clear ( string $objectKey ) : boolean Removes all items.
get ( string $objectKey, mixed $pk, array $options = [] ) : array | null Returns the single row of a object.
getBranch ( $objectKey, mixed $pk = null, array $condition = null, integer $depth = 1, mixed $scope = null, array $options = [] ) : mixed
getBranchChildrenCount ( string $objectKey, mixed $pk = null, array $condition = null, mixed $scope = null, array $options = [] ) : array Counts the items of $objectKey filtered by $condition
getBundleName ( $objectKey ) : null | string Cuts of the object name of the object key.
getCount ( string $objectKey, array $condition = null, array $options = [] ) : array Counts the items of $objectKey filtered by $condition
getCountFromUrl ( $internalUrl ) : array Counts the items of $internalUrl
getCroppedObjectId ( string $url ) : string This just cut off object:/// and returns the primary key part as plain text.
getDefinition ( string $objectKey ) : Object | null Get object's definition.
getFromUrl ( $internalUrl ) : array Returns the object for the given url. Same arguments as in jarvesObjects::get() but given by a string.
getList ( string $objectKey, array $filter = null, array $options = [] ) : array | boolean Returns the list of objects.
getName ( string $objectKey ) : string | null Cuts of the namespace/module name of a object key.
getNamespace ( string $objectKey ) : string Returns the namespace of the bundle of the object key.
getObjectKey ( string $url ) : string Returns the object key (not id) from an object url.
getObjectPk ( string $objectKey, array $item ) : string Return only the primary keys of pItem as object.
getObjectUrlId ( string $objectKey, array $pk ) : string Returns the id of an object item for the usage in urls (internal url's) - urlencoded.
getParent ( string $objectKey, mixed $pk, array $options = null ) : mixed Returns the parent item per url. Only if the object is nested.
getParentFromUrl ( string $objectUrl ) : array Returns the parent item. Only if the object is nested.
getParentPk ( string $objectKey, mixed $pk ) : array Returns the parent pk.
getParentPkFromUrl ( string $objectUrl ) : array Returns the parent pk from a url.
getParents ( string $objectKey, mixed $pk, array $options = null ) : mixed Returns all parents, incl. the root object (if root is an object, it returns this object entry as well)
getParentsFromUrl ( string $objectUrl ) : mixed Returns all parents per url, incl. the root object (if root is an object, it returns this object entry as well)
getPrimaries ( $objectId ) : array Returns a hash of all primary fields.
getPrimaryList ( $objectId ) : array Return a list of all primary keys.
getPublicUrl ( string $objectKey, string $pk, array $pluginProperties = null ) : string Returns the public URL.
getRepository ( string $objectKey, array $options = null ) : ObjectCrud Returns the controller to be used to call each update and query at. This controller handles a bit more than the pure storageController. For example: ACL, automatic filtering (per language) and event dispatcher.
getRoot ( string $objectKey, mixed $scope, array $options = [] ) : array Returns a single root item. Only for nested objects.
getRoots ( string $objectKey, array $condition = null, array $options = [] ) : array Returns all roots. Only for nested objects.
getStorageController ( string $objectKey ) : AbstractStorage Returns the storage controller, which directly accesses the actual object.
getTable ( string $objectKey ) : string Returns the table name behind a object.
getUrl ( string $internalUrl ) : string | boolean Translates the internal url to the real path.
isNested ( string $objectKey ) : boolean Returns true of the object is nested.
move ( string $objectKey, array $pk, array $targetPk, string $position = 'first', string $targetObjectKey = null, array $options ) : mixed Moves a item to a new position.
moveFromUrl ( string $sourceObjectUrl, string $targetObjectUrl, string $position = 'first', array $options = null ) : mixed Moves a item around by a url.
normalizeObjectKey ( string $key ) : string
normalizePk ( string $objectKey, mixed $pk ) : array Returns always a array with primary key and value pairs from a single pk.
normalizePkString ( string $objectKey, string $pkString ) : array | null Parses a whole (can be multiple) primary key that is a represented as string and returns the first primary key.
parsePk ( string $objectKey, string $primaryKey ) : array Converts the primary key statement of a url to normalized structure.
parseUrl ( string $internalUrl ) : array Parse the internal object url scheme and return the information as array.
patch ( string $objectKey, mixed $pk, array $values, array $options = [] ) : boolean Patches a object entry. This means, only defined fields will be saved. Fields which are not defined will not be overwritten.
remove ( string $objectKey, mixed $pk, array $options = [] ) : boolean Removes a object item.
removeFromUrl ( string $objectUrl, array $options = [] ) : boolean Removes a object item per url.
toUrl ( string $objectKey, mixed $primaryValues ) : string Converts given object key and the object item to the internal url.
update ( string $objectKey, mixed $pk, array $values, array $options = [] ) : boolean Updates a object entry. This means, all fields which are not defined will be saved as NULL.
updateFromUrl ( string $objectUrl, array $values ) : boolean Updates a item per url.

Method Details

__construct() public méthode

public __construct ( Jarves $jarves, Symfony\Component\DependencyInjection\ContainerInterface $container )
$jarves Jarves
$container Symfony\Component\DependencyInjection\ContainerInterface

add() public méthode

Adds a item.
public add ( string $objectKey, array $values, mixed $targetPk = null, string $position = 'first', boolean $targetObjectKey = null, array $options = [] ) : mixed
$objectKey string
$values array
$targetPk mixed Full PK as array or as primary key string (url).
$position string If nested set. `first` (child), `last` (last child), `prev` (sibling), `next` (sibling)
$targetObjectKey boolean If this object key differs from $objectKey then we'll use $pk as `scope`. Also it is then only possible to have position `first` and `last`.
$options array
Résultat mixed

checkField() public méthode

Checks if a field in a object exists.
public checkField ( string $objectKey, string $field ) : boolean
$objectKey string
$field string
Résultat boolean

cleanup() public méthode

Clears the instances cache.
public cleanup ( )

clear() public méthode

Removes all items.
public clear ( string $objectKey ) : boolean
$objectKey string
Résultat boolean

get() public méthode

$options is a array which can contain following options. All options are optional. '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('field' => 'category', 'direction' => 'asc'), array('field' => 'title', 'direction' => 'asc') ) 'foreignKeys' Define which column should be resolved. If empty all columns will be resolved. Use a array or a comma separated list (like in SQL SELECT) 'permissionCheck' Defines whether we check against the ACL or not. true or false. default false
public get ( string $objectKey, mixed $pk, array $options = [] ) : array | null
$objectKey string
$pk mixed
$options array
Résultat array | null

getBranch() public méthode

public getBranch ( $objectKey, mixed $pk = null, array $condition = null, integer $depth = 1, mixed $scope = null, array $options = [] ) : mixed
$objectKey
$pk mixed
$condition array
$depth integer
$scope mixed
$options array
Résultat mixed

getBranchChildrenCount() public méthode

Counts the items of $objectKey filtered by $condition
public getBranchChildrenCount ( string $objectKey, mixed $pk = null, array $condition = null, mixed $scope = null, array $options = [] ) : array
$objectKey string
$pk mixed
$condition array
$scope mixed
$options array
Résultat array

getBundleName() public méthode

jarves/node => JarvesBundle.
public getBundleName ( $objectKey ) : null | string
$objectKey
Résultat null | string

getCount() public méthode

Counts the items of $objectKey filtered by $condition
public getCount ( string $objectKey, array $condition = null, array $options = [] ) : array
$objectKey string
$condition array
$options array
Résultat array

getCountFromUrl() public méthode

Counts the items of $internalUrl
public getCountFromUrl ( $internalUrl ) : array
$internalUrl
Résultat array

getCroppedObjectId() public méthode

This just cut off object:/// and returns the primary key part as plain text.
public getCroppedObjectId ( string $url ) : string
$url string
Résultat string

getDefinition() public méthode

Get object's definition.
public getDefinition ( string $objectKey ) : Object | null
$objectKey string `Core\Language` or `Core.Language`.
Résultat Jarves\Configuration\Object | null

getFromUrl() public méthode

Take a look at the jarvesObjects::parseUrl() method for more information.
public getFromUrl ( $internalUrl ) : array
$internalUrl
Résultat array

getList() public méthode

$options is a array which can contain following options. All options are optional. '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
public getList ( string $objectKey, array $filter = null, array $options = [] ) : array | boolean
$objectKey string
$filter array
$options array
Résultat array | boolean

getName() public méthode

jarves/node => Node.
public getName ( string $objectKey ) : string | null
$objectKey string
Résultat string | null

getNamespace() public méthode

JarvesBundle/node => JarvesBundle. bundleWithNameSpace/myObject => Bundle\With\Namespace.
public getNamespace ( string $objectKey ) : string
$objectKey string
Résultat string

getObjectKey() public méthode

Returns the object key (not id) from an object url.
public getObjectKey ( string $url ) : string
$url string
Résultat string

getObjectPk() public méthode

Return only the primary keys of pItem as object.
public getObjectPk ( string $objectKey, array $item ) : string
$objectKey string
$item array
Résultat string

getObjectUrlId() public méthode

Returns the id of an object item for the usage in urls (internal url's) - urlencoded.
public getObjectUrlId ( string $objectKey, array $pk ) : string
$objectKey string
$pk array
Résultat string

getParent() public méthode

Returns the parent item per url. Only if the object is nested.
public getParent ( string $objectKey, mixed $pk, array $options = null ) : mixed
$objectKey string
$pk mixed
$options array
Résultat mixed

getParentFromUrl() public méthode

Returns the parent item. Only if the object is nested.
public getParentFromUrl ( string $objectUrl ) : array
$objectUrl string
Résultat array

getParentPk() public méthode

Returns the parent pk.
public getParentPk ( string $objectKey, mixed $pk ) : array
$objectKey string
$pk mixed
Résultat array

getParentPkFromUrl() public méthode

Returns the parent pk from a url.
public getParentPkFromUrl ( string $objectUrl ) : array
$objectUrl string
Résultat array

getParents() public méthode

Returns all parents, incl. the root object (if root is an object, it returns this object entry as well)
public getParents ( string $objectKey, mixed $pk, array $options = null ) : mixed
$objectKey string
$pk mixed
$options array
Résultat mixed

getParentsFromUrl() public méthode

Returns all parents per url, incl. the root object (if root is an object, it returns this object entry as well)
public getParentsFromUrl ( string $objectUrl ) : mixed
$objectUrl string
Résultat mixed

getPrimaries() public méthode

Returns array('' => , '' => , ...)
public getPrimaries ( $objectId ) : array
$objectId
Résultat array

getPrimaryList() public méthode

Returns array('', '', ...);
public getPrimaryList ( $objectId ) : array
$objectId
Résultat array

getPublicUrl() public méthode

Returns the public URL.
public getPublicUrl ( string $objectKey, string $pk, array $pluginProperties = null ) : string
$objectKey string
$pk string
$pluginProperties array
Résultat string

getRepository() public méthode

It needs to extend ObjectCrud.
public getRepository ( string $objectKey, array $options = null ) : ObjectCrud
$objectKey string
$options array
Résultat Jarves\Admin\ObjectCrud

getRoot() public méthode

Returns a single root item. Only for nested objects.
public getRoot ( string $objectKey, mixed $scope, array $options = [] ) : array
$objectKey string
$scope mixed
$options array
Résultat array

getRoots() public méthode

Returns all roots. Only for nested objects.
public getRoots ( string $objectKey, array $condition = null, array $options = [] ) : array
$objectKey string
$condition array
$options array
Résultat array

getStorageController() public méthode

Returns the storage controller, which directly accesses the actual object.
public getStorageController ( string $objectKey ) : AbstractStorage
$objectKey string
Résultat Jarves\Storage\AbstractStorage

getTable() public méthode

Not all objects has a table. If the object is based on propel's orm, then it has one.
public getTable ( string $objectKey ) : string
$objectKey string
Résultat string

getUrl() public méthode

Example: getUrl('file://45') => '/myImageFolder/Picture1.png' getUrl('news://4') => '/newspage/detail/my-news-title' getUrl('user://1') => '/userdetail/admini-strator'
public getUrl ( string $internalUrl ) : string | boolean
$internalUrl string
Résultat string | boolean

isNested() public méthode

Returns true of the object is nested.
public isNested ( string $objectKey ) : boolean
$objectKey string
Résultat boolean

move() public méthode

Moves a item to a new position.
public move ( string $objectKey, array $pk, array $targetPk, string $position = 'first', string $targetObjectKey = null, array $options ) : mixed
$objectKey string
$pk array
$targetPk array
$position string `first` (child), `last` (last child), `prev` (sibling), `next` (sibling)
$targetObjectKey string
$options array
Résultat mixed

moveFromUrl() public méthode

Moves a item around by a url.
public moveFromUrl ( string $sourceObjectUrl, string $targetObjectUrl, string $position = 'first', array $options = null ) : mixed
$sourceObjectUrl string
$targetObjectUrl string
$position string
$options array
Résultat mixed

normalizeObjectKey() public static méthode

public static normalizeObjectKey ( string $key ) : string
$key string
Résultat string

normalizePk() public méthode

$pk can be - 24 - array(24) - array('id' => 24) result: array( 'id' => 24 );
public normalizePk ( string $objectKey, mixed $pk ) : array
$objectKey string
$pk mixed
Résultat array A single primary key as array. Example: array('id' => 1).

normalizePkString() public méthode

Example: 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 normalizePkString ( string $objectKey, string $pkString ) : array | null
$objectKey string
$pkString string
Résultat array | null Example array('id' => 4)

parsePk() public méthode

Generates a array for the usage of Core\Object:get() 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, id2 => "Bar")) 1-45, 2-45 => array(array(id => 1, pid = 45), array(id => 2, pid=>45))
public parsePk ( string $objectKey, string $primaryKey ) : array
$objectKey string
$primaryKey string
Résultat array

parseUrl() public méthode

Pattern: object://[/][/][/?] Examples: 1. object://news/1 => returns the object news with primary value equal 1 2. object://news/id=1 => equal as 1. 3. object://news/1/2 => returns a list of the objects with primary value equal 1 or 2 4. object://news/id=1/id=2 => equal as 3. 5. object://object_with_multiple_primary/2,54 => returns the object with the first primary field equal 2 and second primary field equal 54 6. object://object_with_multiple_primary/2,54/34,55 => returns a list of the objects 7. object://object_with_multiple_primary/id=2,parent_id=54/id=34,parent_id=55 => equal as 6 if the first defined primary is 'id' and the second 'parent_id' 8. object://news/1?fields=title => equal as 1. but returns only the field title 9. object://news/1?fields=title,category_id => equal as 1. but returns only the field title and category_id 10. object://news?fields=title => returns all objects from type news 11. object://news?fields=title&limit=5 => returns first 5 objects from type news
public parseUrl ( string $internalUrl ) : array
$internalUrl string
Résultat array [object_key, object_id/s, queryParams]

patch() public méthode

Patches a object entry. This means, only defined fields will be saved. Fields which are not defined will not be overwritten.
public patch ( string $objectKey, mixed $pk, array $values, array $options = [] ) : boolean
$objectKey string
$pk mixed
$values array
$options array
Résultat boolean

remove() public méthode

Removes a object item.
public remove ( string $objectKey, mixed $pk, array $options = [] ) : boolean
$objectKey string
$pk mixed
$options array
Résultat boolean

removeFromUrl() public méthode

Removes a object item per url.
public removeFromUrl ( string $objectUrl, array $options = [] ) : boolean
$objectUrl string
$options array
Résultat boolean

toUrl() public méthode

Converts given object key and the object item to the internal url.
public toUrl ( string $objectKey, mixed $primaryValues ) : string
$objectKey string
$primaryValues mixed
Résultat string

update() public méthode

Updates a object entry. This means, all fields which are not defined will be saved as NULL.
public update ( string $objectKey, mixed $pk, array $values, array $options = [] ) : boolean
$objectKey string
$pk mixed
$values array
$options array
Résultat boolean

updateFromUrl() public méthode

Updates a item per url.
public updateFromUrl ( string $objectUrl, array $values ) : boolean
$objectUrl string
$values array
Résultat boolean

Property Details

$instances public_oe property

Array of instances of the object classes
public array $instances
Résultat array

$jarves protected_oe property

protected Jarves,jarves $jarves
Résultat Jarves