PHP Класс Spot\Entity\Collection

Наследование: implements Iterator, implements Countable, implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_entityName
$_results
$_resultsIdentities

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

Метод Описание
__construct ( array $results = [], array $resultsIdentities = [], $entityName = null ) Constructor function
__toString ( ) Provides a string representation of the class Brackets contain the number of elements contained in the collection
add ( object $entity ) Add a single entity to the collection
count ( ) Get a count of all the records in the result set
current ( ) ----------------------------------------------
entityName ( )
filter ( $func ) : mixed Runs a function on every object in the query, returning an array containing every object for which the function returns true.
first ( ) : The Returns first result in set
key ( )
map ( $func ) : mixed Runs a function on every object in the query, returning the resulting array
merge ( Collection $collection, $onlyUnique = true ) Merge another collection into this collections set of entities This will only add entitys that don't already exist in the current collection
next ( )
offsetExists ( $key ) ----------------------------------------------
offsetGet ( $key )
offsetSet ( $key, $value )
offsetUnset ( $key )
rewind ( )
run ( $callback ) Run a function on the set of entities
toArray ( mixed $keyColumn = null, mixed $valueColumn = null ) : array Return an array representation of the Collection.
valid ( )

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

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

Constructor function
public __construct ( array $results = [], array $resultsIdentities = [], $entityName = null )
$results array Array of pre-loaded Spot_Entity objects or Iterator that will fetch them lazily
$resultsIdentities array Array of key values for given result set primary key

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

Provides a string representation of the class Brackets contain the number of elements contained in the collection
public __toString ( )

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

Add a single entity to the collection
public add ( object $entity )
$entity object to add

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

Get a count of all the records in the result set
public count ( )

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

----------------------------------------------
public current ( )

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

public entityName ( )

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

Runs a function on every object in the query, returning an array containing every object for which the function returns true.
public filter ( $func ) : mixed
Результат mixed An array of Entity objects

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

Returns first result in set
public first ( ) : The
Результат The first result in the set

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

public key ( )

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

Runs a function on every object in the query, returning the resulting array
public map ( $func ) : mixed
Результат mixed An array containing the result of running the passed function on each member of the collect

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

Merge another collection into this collections set of entities This will only add entitys that don't already exist in the current collection
public merge ( Collection $collection, $onlyUnique = true )
$collection Collection

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

public next ( )

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

----------------------------------------------
public offsetExists ( $key )

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

public offsetGet ( $key )

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

public offsetSet ( $key, $value )

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

public offsetUnset ( $key )

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

public rewind ( )

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

Run a function on the set of entities
public run ( $callback )

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

Return an array representation of the Collection.
public toArray ( mixed $keyColumn = null, mixed $valueColumn = null ) : array
$keyColumn mixed
$valueColumn mixed
Результат array If $keyColumn and $valueColumn are not set, or are both null then this will return the array of entity objects

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

public valid ( )

Описание свойств

$_entityName защищенное свойство

protected $_entityName

$_results защищенное свойство

protected $_results

$_resultsIdentities защищенное свойство

protected $_resultsIdentities