PHP Класс FOF30\Model\DataModel\Collection

Наследование: extends FOF30\Utils\Collection
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__call ( string $name, array $arguments ) Magic method which allows you to run a DataModel method to all items in the collection.
add ( mixed $item ) : Collection Add an item to the collection.
contains ( mixed $key ) : boolean Determine if a key exists in the collection.
diff ( Collection | array $collection ) : Collection Diff the collection with the given items.
fetch ( string $key ) : Collection Fetch a nested element of the collection.
find ( mixed $key, mixed $default = null ) : DataModel Find a model in the collection by key.
intersect ( Collection | array $collection ) : Collection Intersect the collection with the given items.
max ( string $key ) : mixed Get the max value of a given key.
merge ( Collection | array $collection ) : Collection Merge the collection with the given items.
min ( string $key ) : mixed Get the min value of a given key.
modelKeys ( ) : array Get the array of primary keys
removeById ( mixed $key ) : void Remove an item in the collection by key
toBase ( ) : Collection Get a base Support collection instance from this collection.
unique ( ) : Collection Return only unique items from the collection.

Защищенные методы

Метод Описание
getDictionary ( Collection $collection ) : array Get a dictionary keyed by primary keys.

Описание методов

__call() публичный Метод

For example, you can do $collection->save('foobar' => 1) to update the 'foobar' column to 1 across all items in the collection. IMPORTANT: The return value of the method call is not returned back to you!
public __call ( string $name, array $arguments )
$name string The method to call
$arguments array The arguments to the method

add() публичный Метод

Add an item to the collection.
public add ( mixed $item ) : Collection
$item mixed
Результат Collection

contains() публичный Метод

Determine if a key exists in the collection.
public contains ( mixed $key ) : boolean
$key mixed
Результат boolean

diff() публичный Метод

Diff the collection with the given items.
public diff ( Collection | array $collection ) : Collection
$collection FOF30\Utils\Collection | array
Результат FOF30\Utils\Collection

fetch() публичный Метод

Fetch a nested element of the collection.
public fetch ( string $key ) : Collection
$key string
Результат Collection

find() публичный Метод

Find a model in the collection by key.
public find ( mixed $key, mixed $default = null ) : DataModel
$key mixed
$default mixed
Результат FOF30\Model\DataModel

getDictionary() защищенный Метод

Get a dictionary keyed by primary keys.
protected getDictionary ( Collection $collection ) : array
$collection FOF30\Utils\Collection
Результат array

intersect() публичный Метод

Intersect the collection with the given items.
public intersect ( Collection | array $collection ) : Collection
$collection FOF30\Utils\Collection | array
Результат Collection

max() публичный Метод

Get the max value of a given key.
public max ( string $key ) : mixed
$key string
Результат mixed

merge() публичный Метод

Merge the collection with the given items.
public merge ( Collection | array $collection ) : Collection
$collection FOF30\Utils\Collection | array
Результат FOF30\Utils\Collection

min() публичный Метод

Get the min value of a given key.
public min ( string $key ) : mixed
$key string
Результат mixed

modelKeys() публичный Метод

Get the array of primary keys
public modelKeys ( ) : array
Результат array

removeById() публичный Метод

Remove an item in the collection by key
public removeById ( mixed $key ) : void
$key mixed
Результат void

toBase() публичный Метод

Get a base Support collection instance from this collection.
public toBase ( ) : Collection
Результат FOF30\Utils\Collection

unique() публичный Метод

Return only unique items from the collection.
public unique ( ) : Collection
Результат FOF30\Utils\Collection