com\setasign\Konquadrat\Object
ObjectSet Class ObjectSet
File: /Konquadrat/src/Object/ObjectSet.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- __sleep()
- count()
- current()
- filter()
- getActualScope()
- getById()
- getChilds()
- getId()
- getParentIds()
- getParents()
- getReferenceIds()
- getReferences()
- getReferencingObjects()
- getTypes()
- hasChilds()
- hasObject()
- hasReferencingObjects()
- key()
- limit()
- next()
- order()
- reload()
- resolveMagic()
- resolveMagicWithParam()
- rewind()
- setActualScope()
- toArray()
- toDataArray()
- toObjectArray()
- valid()
- withAllChilds()
- withChilds()
- withParents()
- withReferences()
- withReferencingObjects()
Properties
$childFinder
$instancePoolManager
$magicResolver
$magicWithParamResolver
$objectConfig
$objectFactory
$objectFinder
$objectSetFactory
$permissionControl
$position
Cursor for the iterator
$referenceFinder
$referencing
Array with information about referencing objects
- Key => reference target id
- Value => Array:
- Key => Type
- Value => Array:
- Key => Field
- Value => Array(ids)
$referencingObjectsFinder
Methods
__construct()
ObjectSet\ReferenceFinder $referenceFinder,
ObjectSet\ChildFinder $childFinder,
ObjectSet\MagicResolver $magicResolver,
ObjectSet\MagicWithParamResolver $magicWithParamResolver,
ObjectSet\ReferencingObjectsFinder $referencingObjectsFinder,
ObjectSet\Filter $filter,
ObjectSet\Sorter $sorter,
ObjectSet\Reloader $reloader,
ObjectConfig $objectConfig,
ObjectFinder $objectFinder,
ObjectFactoryInterface $objectFactory,
InstancePoolManager $instancePoolManager,
?\com\setasign\Konquadrat\Permission\PermissionControl $permissionControl = null,
array $data = array ( )
ObjectSet constructor.
Parameters
- $objectSetFactory : ObjectSet\ObjectSetFactoryInterface
- $referenceFinder : ObjectSet\ReferenceFinder
- $childFinder : ObjectSet\ChildFinder
- $magicResolver : ObjectSet\MagicResolver
- $magicWithParamResolver : ObjectSet\MagicWithParamResolver
- $referencingObjectsFinder : ObjectSet\ReferencingObjectsFinder
- $filter : ObjectSet\Filter
- $sorter : ObjectSet\Sorter
- $reloader : ObjectSet\Reloader
- $objectConfig : ObjectConfig
- $objectFinder : ObjectFinder
- $objectFactory : ObjectFactoryInterface
- $instancePoolManager : InstancePoolManager
- $permissionControl : ?\com\setasign\Konquadrat\Permission\PermissionControl
- $data : array
count()
(PHP 5 >= 5.1.0)
Count elements of an object
Return Values
The custom count as an integer.
The return value is cast to an integer.
filter()
getById()
?class-string<expectedType> $expectedType = null,
bool $onlyExisting = false
Return the AbstractObject with the id $id.
If the objectId is unknown for the ObjectSet it will redirect the call to ObjectFinder::getById().
The returned ObjectSet is connected with this ObjectSet.
Parameters
- $id : int
- $expectedType : ?class-string<expectedType>
The expected object type.
- $onlyExisting : bool
If set to true the call will not be directed to the objectFinder.
Exceptions
Throws UnknownObjectException If the type doesn't match.
getChilds()
Return an ObjectSet with all known childs of the objects in the actual scope.
It is necessary to previously call withChilds otherwise the returned ObjectSet will be empty.
The returned ObjectSet is connected with this ObjectSet.
Parameters
- $types : null|string|string[]
getParents()
Return an ObjectSet with all known parents of the objects in the actual scope.
It is necessary to previously call withParents otherwise the returned ObjectSet will be empty.
The returned ObjectSet is connected with this ObjectSet.
getReferenceIds()
bool $validateFieldNames = true
Parameters
- $fieldNames : array|string|null
- $validateFieldNames : bool
getReferences()
Return an ObjectSet with all known references of the objects in the actual scope.
It is necessary to previously call withReferences otherwise the returned ObjectSet will be empty.
The returned ObjectSet is connected with this ObjectSet.
The $fieldNames array need to look like this:
$fieldNames = [
'EventRelation' => ['Event', 'parent'],
'Event', // load all references of containing event objects
];
Parameters
- $fieldNames : ?array
getReferencingObjects()
Get all objects of $type that are referencing on any object of the actual scope over the reference field $field.
Parameters
- $type : string
- $field : string
getTypes()
Returns the object types of all objects in the actual scope. Every type is only once in the result.
key()
(PHP 5 >= 5.0.0)
Return the key of the current element
Return Values
scalar on success, or null on failure.
reload()
Reload all objects in the actual scope.
Exceptions
Throws UnknownObjectException If (at least) one object can't be found!
rewind()
(PHP 5 >= 5.0.0)
Rewind the Iterator to the first element
Return Values
Any returned value is ignored.
setActualScope()
Parameters
- $ids : int[]
- $newObject : bool
Defines whether a new object set instance will be created
toArray()
WARNING: This method is marked as deprecated!
Use toDataArray() or toObjectArray() instead
Returns the actual scope as array.
If $asObject is false the result will be an array filled with associative arrays. If $asObject is true the result will be an array filled with AbstractObjects.
Parameters
- $asObject : bool
valid()
(PHP 5 >= 5.0.0)
Checks if current position is valid
Return Values
The return value will be cast to boolean and then evaluated. Returns true on success or false on failure.
withAllChilds()
This method will load all objects below the actual scope via the path.
Parameters
- $types : string|string[]|null
See
withChilds()
null $selectors = null
Parameters
- $types : string|string[]|null
- $selectors : null
