PHP 클래스 Jarves\Objects

파일 보기 프로젝트 열기: jarves/jarves 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$instances array Array of instances of the object classes

보호된 프로퍼티들

프로퍼티 타입 설명
$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