PHP Класс Jarves\Objects

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$instances array Array of instances of the object classes

Защищенные свойства (Protected)

Свойство Тип Описание
$jarves Jarves

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

Метод Описание
__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.

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

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

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

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

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
Результат mixed

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

Checks if a field in a object exists.
public checkField ( string $objectKey, string $field ) : boolean
$objectKey string
$field string
Результат boolean

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

Clears the instances cache.
public cleanup ( )

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

Removes all items.
public clear ( string $objectKey ) : boolean
$objectKey string
Результат boolean

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

$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
Результат array | null

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

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
Результат mixed

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

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
Результат array

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

jarves/node => JarvesBundle.
public getBundleName ( $objectKey ) : null | string
$objectKey
Результат null | string

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

Counts the items of $objectKey filtered by $condition
public getCount ( string $objectKey, array $condition = null, array $options = [] ) : array
$objectKey string
$condition array
$options array
Результат array

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

Counts the items of $internalUrl
public getCountFromUrl ( $internalUrl ) : array
$internalUrl
Результат array

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

This just cut off object:/// and returns the primary key part as plain text.
public getCroppedObjectId ( string $url ) : string
$url string
Результат string

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

Get object's definition.
public getDefinition ( string $objectKey ) : Object | null
$objectKey string `Core\Language` or `Core.Language`.
Результат Jarves\Configuration\Object | null

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

Take a look at the jarvesObjects::parseUrl() method for more information.
public getFromUrl ( $internalUrl ) : array
$internalUrl
Результат array

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

$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
Результат array | boolean

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

jarves/node => Node.
public getName ( string $objectKey ) : string | null
$objectKey string
Результат string | null

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

JarvesBundle/node => JarvesBundle. bundleWithNameSpace/myObject => Bundle\With\Namespace.
public getNamespace ( string $objectKey ) : string
$objectKey string
Результат string

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

Returns the object key (not id) from an object url.
public getObjectKey ( string $url ) : string
$url string
Результат string

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

Return only the primary keys of pItem as object.
public getObjectPk ( string $objectKey, array $item ) : string
$objectKey string
$item array
Результат string

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

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
Результат string

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

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
Результат mixed

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

Returns the parent item. Only if the object is nested.
public getParentFromUrl ( string $objectUrl ) : array
$objectUrl string
Результат array

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

Returns the parent pk.
public getParentPk ( string $objectKey, mixed $pk ) : array
$objectKey string
$pk mixed
Результат array

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

Returns the parent pk from a url.
public getParentPkFromUrl ( string $objectUrl ) : array
$objectUrl string
Результат array

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

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
Результат mixed

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

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
Результат mixed

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

Returns array('' => , '' => , ...)
public getPrimaries ( $objectId ) : array
$objectId
Результат array

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

Returns array('', '', ...);
public getPrimaryList ( $objectId ) : array
$objectId
Результат array

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

Returns the public URL.
public getPublicUrl ( string $objectKey, string $pk, array $pluginProperties = null ) : string
$objectKey string
$pk string
$pluginProperties array
Результат string

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

It needs to extend ObjectCrud.
public getRepository ( string $objectKey, array $options = null ) : ObjectCrud
$objectKey string
$options array
Результат Jarves\Admin\ObjectCrud

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

Returns a single root item. Only for nested objects.
public getRoot ( string $objectKey, mixed $scope, array $options = [] ) : array
$objectKey string
$scope mixed
$options array
Результат array

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

Returns all roots. Only for nested objects.
public getRoots ( string $objectKey, array $condition = null, array $options = [] ) : array
$objectKey string
$condition array
$options array
Результат array

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

Returns the storage controller, which directly accesses the actual object.
public getStorageController ( string $objectKey ) : AbstractStorage
$objectKey string
Результат Jarves\Storage\AbstractStorage

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

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
Результат string

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

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
Результат string | boolean

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

Returns true of the object is nested.
public isNested ( string $objectKey ) : boolean
$objectKey string
Результат boolean

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

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
Результат mixed

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

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
Результат mixed

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

public static normalizeObjectKey ( string $key ) : string
$key string
Результат string

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

$pk can be - 24 - array(24) - array('id' => 24) result: array( 'id' => 24 );
public normalizePk ( string $objectKey, mixed $pk ) : array
$objectKey string
$pk mixed
Результат array A single primary key as array. Example: array('id' => 1).

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

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
Результат array | null Example array('id' => 4)

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

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
Результат array

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

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
Результат array [object_key, object_id/s, queryParams]

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

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
Результат boolean

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

Removes a object item.
public remove ( string $objectKey, mixed $pk, array $options = [] ) : boolean
$objectKey string
$pk mixed
$options array
Результат boolean

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

Removes a object item per url.
public removeFromUrl ( string $objectUrl, array $options = [] ) : boolean
$objectUrl string
$options array
Результат boolean

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

Converts given object key and the object item to the internal url.
public toUrl ( string $objectKey, mixed $primaryValues ) : string
$objectKey string
$primaryValues mixed
Результат string

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

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
Результат boolean

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

Updates a item per url.
public updateFromUrl ( string $objectUrl, array $values ) : boolean
$objectUrl string
$values array
Результат boolean

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

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

Array of instances of the object classes
public array $instances
Результат array

$jarves защищенное свойство

protected Jarves,jarves $jarves
Результат Jarves