Index
-
\com\setasign\Konquadrat
-
Object
- AbstractCachingDocument
- AbstractObject
- AbstractObjectInterface
- AbstractObjectSet
- Action
- ActionResolver
- ActionResolverInterface
- Custom
- Database
- DocumentInterface
- DocumentResolver
- DocumentResolverInterface
- GlobalDiWakeupObjectResolver
- History
- ImportInterface
- InitTraitResolver
- InitTraitResolverInterface
- InstancePool
- InstancePoolInterface
- InstancePoolManager
- ManualQueryBuilder
- MassActionResolver
- MassActionResolverInterface
- MessageList
- MissingConfigurationException
- ObjectConfig
- ObjectFactory
- ObjectFactoryInterface
- ObjectFinder
- ObjectManager
- ObjectSaveException
- ObjectSet
- ObjectSet
- ObjectTableManager
- Scope
- Selector
- SmartObjectSet
- TemporaryReference
- TransactionManager
- UnknownObjectException
- WakeupObjectResolverInterface
-
Object
com\setasign\Konquadrat\Object
SmartObjectSet Class SmartObjectSet
File: /Konquadrat/src/Object/SmartObjectSet.php
A smart object set will use smart/lazy eager loading to solve the n+1 problem instead of eager loading of the ObjectSet.
The smart object set will completely ignore already existing instances of objects and don't use any instance pool. Every object created by a smart object set is unique and not shared.
Class hierarchy
Implements
Summary
Methods
- __construct()
- __sleep()
- count()
- current()
- filter()
- getActualScope()
- getById()
- getChilds()
- getFullObjectSet()
- getParentIds()
- getParents()
- getReferenceIds()
- getReferences()
- getReferencingObjects()
- getTypes()
- hasChilds()
- hasObject()
- hasReferencingObjects()
- key()
- limit()
- next()
- order()
- reload()
- rewind()
- toArray()
- toDataArray()
- toObjectArray()
- valid()
- withAllChilds()
- withChilds()
- withParents()
- withReferences()
- withReferencingObjects()
Constants
SOURCE_CHILDS
SOURCE_FILTER
SOURCE_FORK
SOURCE_PARENT
SOURCE_REFERENCE
SOURCE_REFERENCING
Properties
$childFinder
$filter
$isFork
$magicResolver
$magicWithParamResolver
$objectConfig
$objectFactory
$objectFinder
$objectSetFactory
$parentObjectSet
$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
$source
$sourcePayload
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,
?\com\setasign\Konquadrat\Permission\PermissionControl $permissionControl = null,
array $data = array ( ),
?SmartObjectSet $parentObjectSet = null,
?string $sourceType = null,
?array $sourcePayload = null
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
- $permissionControl : ?\com\setasign\Konquadrat\Permission\PermissionControl
- $data : array
- $parentObjectSet : ?SmartObjectSet
- $sourceType : ?string
- $sourcePayload : ?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
Return the AbstractObject with the id $id.
Note: The Smart ObjectSet it won't redirect the call to ObjectFinder::getById().
Parameters
- $id : int
- $expectedType : ?class-string<expectedType>
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[]
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.
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.
hasObject()
Checks whether the object is inside the objectSet.
Note: Doesn't check whether the object is inside the actual scope!
Parameters
- $id : int
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.
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.
withChilds()
null $selectors = null
Parameters
- $types : string|string[]|null
- $selectors : null
withReferencingObjects()
string $field
Parameters
- $type : string
- $field : string
