Documentation

ObjectCollection extends ArrayCollection
in package
implements NestedObjectCollectionInterface uses ObjectCollectionTrait, NestedPropertyCollectionTrait

Class contains a collection of objects.

Tags
template
template
extends
implements

Table of Contents

Interfaces

NestedObjectCollectionInterface
Common Interface for both Objects and Collections

Properties

$type  : string
$_key  : string

Methods

__construct()  : mixed
__serialize()  : array<string|int, mixed>
__toString()  : string
Returns a string representation of this object.
__unserialize()  : void
call()  : array<string|int, mixed>
chunk()  : array<string|int, mixed>
Split collection into chunks.
collectionGroup()  : array<string|int, static>
Group items in the collection by a field and return them as associated array of collections.
copy()  : T>
Create a copy from this collection by cloning all objects in the collection.
defNestedProperty()  : $this
defProperty()  : $this
doDefProperty()  : $this
doGetProperty()  : array<string|int, mixed>
doHasProperty()  : array<string|int, bool>
doSetProperty()  : $this
doUnsetProperty()  : $this
getKey()  : string
getNestedProperty()  : array<string|int, mixed>
getObjectKeys()  : array<string|int, string>
getProperty()  : array<string|int, mixed>
getType()  : string
group()  : array<string|int, mixed>
Group items in the collection by a field and return them as associated array.
hasKey()  : bool
hasNestedProperty()  : array<string|int, mixed>
hasProperty()  : array<string|int, bool>
jsonSerialize()  : array<string|int, mixed>
Implements JsonSerializable interface.
limit()  : static
matching()  : static
orderBy()  : static
reverse()  : static
Reverse the order of the items.
select()  : static
Select items from collection.
setKey()  : $this
setNestedProperty()  : $this
setProperty()  : $this
shuffle()  : static
Shuffle items.
unselect()  : static
Un-select items from collection.
unsetNestedProperty()  : $this
unsetProperty()  : $this
doSerialize()  : array<string|int, mixed>
doUnserialize()  : void
getElements()  : array<string|int, mixed>
getTypePrefix()  : string
setElements()  : array<string|int, mixed>

Properties

Methods

__construct()

public __construct([array<string|int, mixed> $elements = [] ][, string|null $key = null ]) : mixed
Parameters
$elements : array<string|int, mixed> = []
$key : string|null = null
Tags
throws
InvalidArgumentException

__serialize()

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

Returns a string representation of this object.

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

call()

public call(string $method[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>
Parameters
$method : string

Method name.

$arguments : array<string|int, mixed> = []

List of arguments passed to the function.

Return values
array<string|int, mixed>

Return values.

chunk()

Split collection into chunks.

public chunk(int $size) : array<string|int, mixed>
Parameters
$size : int

Size of each chunk.

Tags
phpstan-return

array<array<TKey,T>>

Return values
array<string|int, mixed>

collectionGroup()

Group items in the collection by a field and return them as associated array of collections.

public collectionGroup(string $property) : array<string|int, static>
Parameters
$property : string
Tags
phpstan-return

array<static<TKey,T>>

Return values
array<string|int, static>

copy()

Create a copy from this collection by cloning all objects in the collection.

public copy() : T>
Return values
T>

defNestedProperty()

public defNestedProperty(string $property, string $default[, string|null $separator = null ]) : $this
Parameters
$property : string

Object property to be updated.

$default : string

Default value.

$separator : string|null = null

Separator, defaults to '.'

Return values
$this

defProperty()

public defProperty(string $property, mixed $default) : $this
Parameters
$property : string

Object property to be defined.

$default : mixed

Default value.

Return values
$this

doDefProperty()

public doDefProperty(string $property, mixed $default) : $this
Parameters
$property : string

Object property to be updated.

$default : mixed

Default value.

Return values
$this

doGetProperty()

public & doGetProperty(string $property[, mixed $default = null ][, bool $doCreate = false ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if not set.

$doCreate : bool = false

Not being used.

Return values
array<string|int, mixed>

Key/Value pairs of the properties.

doHasProperty()

public doHasProperty(string $property) : array<string|int, bool>
Parameters
$property : string

Object property to be matched.

Return values
array<string|int, bool>

Key/Value pairs of the properties.

doSetProperty()

public doSetProperty(string $property, mixed $value) : $this
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

Return values
$this

doUnsetProperty()

public doUnsetProperty(string $property) : $this
Parameters
$property : string

Object property to be updated.

Return values
$this

getNestedProperty()

public getNestedProperty(string $property[, mixed $default = null ][, string|null $separator = null ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if not set.

$separator : string|null = null

Separator, defaults to '.'

Return values
array<string|int, mixed>

Key/Value pairs of the properties.

getObjectKeys()

public getObjectKeys() : array<string|int, string>
Return values
array<string|int, string>

getProperty()

public getProperty(string $property[, mixed $default = null ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if property has not been set.

Return values
array<string|int, mixed>

Property values.

getType()

public getType([bool $prefix = true ]) : string
Parameters
$prefix : bool = true
Return values
string

group()

Group items in the collection by a field and return them as associated array.

public group(string $property) : array<string|int, mixed>
Parameters
$property : string
Tags
phpstan-return

array<TKey,T>

Return values
array<string|int, mixed>

hasNestedProperty()

public hasNestedProperty(string $property[, string|null $separator = null ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be matched.

$separator : string|null = null

Separator, defaults to '.'

Return values
array<string|int, mixed>

Key/Value pairs of the properties.

hasProperty()

public hasProperty(string $property) : array<string|int, bool>
Parameters
$property : string

Object property name.

Return values
array<string|int, bool>

True if property has been defined (can be null).

jsonSerialize()

Implements JsonSerializable interface.

public jsonSerialize() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

limit()

public limit(int $start[, int|null $limit = null ]) : static
Parameters
$start : int
$limit : int|null = null
Tags
phpstan-return

static<TKey,T>

Return values
static

matching()

public matching(Criteria $criteria) : static
Parameters
$criteria : Criteria
Tags
phpstan-return

static<TKey,T>

Return values
static

orderBy()

public orderBy(array<string|int, mixed> $ordering) : static
Parameters
$ordering : array<string|int, mixed>
Tags
phpstan-return

static<TKey,T>

Return values
static

reverse()

Reverse the order of the items.

public reverse() : static
Tags
phpstan-return

static<TKey,T>

Return values
static

select()

Select items from collection.

public select(array<int, string> $keys) : static

Collection is returned in the order of $keys given to the function.

Parameters
$keys : array<int, string>
Tags
phpstan-param

TKey[] $keys

phpstan-return

static<TKey,T>

Return values
static

setNestedProperty()

public setNestedProperty(string $property, mixed $value[, string|null $separator = null ]) : $this
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

$separator : string|null = null

Separator, defaults to '.'

Return values
$this

setProperty()

public setProperty(string $property, mixed $value) : $this
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

Return values
$this

shuffle()

Shuffle items.

public shuffle() : static
Tags
phpstan-return

static<TKey,T>

Return values
static

unselect()

Un-select items from collection.

public unselect(array<string|int, int|string> $keys) : static
Parameters
$keys : array<string|int, int|string>
Tags
phpstan-param

TKey[] $keys

phpstan-return

static<TKey,T>

Return values
static

unsetNestedProperty()

public unsetNestedProperty(string $property[, string|null $separator = null ]) : $this
Parameters
$property : string

Object property to be updated.

$separator : string|null = null

Separator, defaults to '.'

Return values
$this

unsetProperty()

public unsetProperty(string $property) : $this
Parameters
$property : string

Object property to be unset.

Return values
$this

doSerialize()

protected doSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

doUnserialize()

protected doUnserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

getElements()

protected getElements() : array<string|int, mixed>
Tags
phpstan-return

array<TKey,T>

Return values
array<string|int, mixed>

setElements()

protected setElements(array<string|int, mixed> $elements) : array<string|int, mixed>
Parameters
$elements : array<string|int, mixed>
Tags
phpstan-return

array<TKey,T>

Return values
array<string|int, mixed>

        
On this page

Search results