com\setasign\Konquadrat\Object

AbstractObjectSet Class AbstractObjectSet

File: /Konquadrat/src/Object/AbstractObjectSet.php

Class hierarchy

Implements

Summary

Properties

$actualScope

protected int[] AbstractObjectSet::$actualScope = array()

The ids of the actual run throw

$objectConfig

$objectData

protected array<int, array> AbstractObjectSet::$objectData = array()

Array with all objectData from this objectSet

Key => id
Value => data

$objectFinder

$position

Cursor for the iterator

$referencing

protected AbstractObjectSet::$referencing = array()

Array with information about referencing objects

  • Key => reference target id
  • Value => Array:
    • Key => Type
    • Value => Array:
      • Key => Field
      • Value => Array(ids)

$reloader

$sorter


Methods

__construct()

public AbstractObjectSet::__construct (
ObjectSet\Sorter $sorter,
ObjectSet\Reloader $reloader,
ObjectConfig $objectConfig,
ObjectFinder $objectFinder
)
Parameters
$sorter : ObjectSet\Sorter
 
$reloader : ObjectSet\Reloader
 
$objectConfig : ObjectConfig
 
$objectFinder : ObjectFinder
 

__sleep()

public AbstractObjectSet::__sleep (
void
): void

count()

public AbstractObjectSet::count (
void
): int

(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.

current()

public AbstractObjectSet::current (
void
): ?mixed

(PHP 5 >= 5.0.0)
Return the current element

filter()

abstract public AbstractObjectSet::filter (
Selector|Selector[] $filters
): self
Parameters
$filters : Selector|Selector[]
 
See
  • \com\setasign\Konquadrat\Object\Filter::filter()

getActualScope()

public AbstractObjectSet::getActualScope (
void
): array

Returns the object ids of the objects in the actual scope.

getById()

abstract public AbstractObjectSet::getById (
int $id,
?class-string<expectedType> $expectedType = null
): AbstractObject|expectedType
Parameters
$id : int
 
$expectedType : ?class-string<expectedType>
 
Exceptions

Throws UnknownObjectException If the type doesn't match or id is unknown.

getChilds()

abstract public AbstractObjectSet::getChilds (
null|string|string[] $types = null
): self

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[]
 

getParentIds()

public AbstractObjectSet::getParentIds (
void
): array

getParents()

abstract public AbstractObjectSet::getParents (
void
): self

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()

public AbstractObjectSet::getReferenceIds (
array|string|null $fieldNames = null,
bool $validateFieldNames = true
): array
Parameters
$fieldNames : array|string|null
 
$validateFieldNames : bool
 

getReferences()

abstract public AbstractObjectSet::getReferences (
?array $fieldNames = null
): self

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()

abstract public AbstractObjectSet::getReferencingObjects (
string $type,
string $field
): self

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()

public AbstractObjectSet::getTypes (
void
): array

Returns the object types of all objects in the actual scope. Every type is only once in the result.

hasChilds()

abstract public AbstractObjectSet::hasChilds (
null|string|string[] $types = null
): bool
Parameters
$types : null|string|string[]
 

hasObject()

public AbstractObjectSet::hasObject (
int $id
): bool

Checks whether the object is inside the objectSet.

Note: Doesn't check whether the object is inside the actual scope!

Parameters
$id : int
 

hasReferencingObjects()

public AbstractObjectSet::hasReferencingObjects (
string $type,
string $field
): bool
Parameters
$type : string
 
$field : string
 

key()

public AbstractObjectSet::key (
void
): ?int

(PHP 5 >= 5.0.0)
Return the key of the current element

Return Values

scalar on success, or null on failure.

limit()

public AbstractObjectSet::limit (
int $limit,
?int $offset = null
): self
Parameters
$limit : int
 
$offset : ?int
 

next()

public AbstractObjectSet::next (
void
): void

(PHP 5 >= 5.0.0)
Move forward to next element

Return Values

Any returned value is ignored.

order()

public AbstractObjectSet::order (
string|array|callable $orders
): self
Parameters
$orders : string|array|callable
 
See

reload()

public AbstractObjectSet::reload (
void
): static

Reload all objects in the actual scope.

Exceptions

Throws UnknownObjectException If (at least) one object can't be found!

resolveMagic()

abstract public AbstractObjectSet::resolveMagic (
?array $fieldNames = null
): self
Parameters
$fieldNames : ?array
 
See
  • \com\setasign\Konquadrat\Object\MagicResolver::resolve()

resolveMagicWithParam()

abstract public AbstractObjectSet::resolveMagicWithParam (
array $fieldNames
): self
Parameters
$fieldNames : array
 
See
  • \com\setasign\Konquadrat\Object\MagicWithParamResolver::resolve()

rewind()

public AbstractObjectSet::rewind (
void
): void

(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

public AbstractObjectSet::toArray (
bool $asObject = false
): array

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
 

toDataArray()

public AbstractObjectSet::toDataArray (
void
): array

toObjectArray()

public AbstractObjectSet::toObjectArray (
void
): array

Returns the actual scope as an array ob AbstractObjects.

valid()

public AbstractObjectSet::valid (
void
): bool

(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()

abstract public AbstractObjectSet::withAllChilds (
string|string[]|null $types = null
): self

This method will load all objects below the actual scope via the path.

Parameters
$types : string|string[]|null
 
See
  • \com\setasign\Konquadrat\Object\ChildFinder::fetchByPath()

withChilds()

abstract public AbstractObjectSet::withChilds (
string|string[]|null $types = null,
null $selectors = null
): ObjectSet\ResolveHelper
Parameters
$types : string|string[]|null
 
$selectors : null
 
See
  • \com\setasign\Konquadrat\Object\ChildFinder::fetch()

withParents()

withReferences()

abstract public AbstractObjectSet::withReferences (
?array $fieldNames = null
): ObjectSet\ResolveHelper
Parameters
$fieldNames : ?array
 
See
  • \com\setasign\Konquadrat\Object\ReferenceFinder::fetch()

withReferencingObjects()

abstract public AbstractObjectSet::withReferencingObjects (
string $type,
string $field
): ObjectSet\ResolveHelper
Parameters
$type : string
 
$field : string