PHP Class Spot\Entity\Collection

Inheritance: implements Iterator, implements Countable, implements ArrayAccess
Afficher le fichier Open project: vlucas/spot Class Usage Examples

Protected Properties

Свойство Type Description
$_entityName
$_results
$_resultsIdentities

Méthodes publiques

Méthode Description
__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 ( )

Method Details

__construct() public méthode

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() public méthode

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

add() public méthode

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

count() public méthode

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

current() public méthode

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

entityName() public méthode

public entityName ( )

filter() public méthode

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
Résultat mixed An array of Entity objects

first() public méthode

Returns first result in set
public first ( ) : The
Résultat The first result in the set

key() public méthode

public key ( )

map() public méthode

Runs a function on every object in the query, returning the resulting array
public map ( $func ) : mixed
Résultat mixed An array containing the result of running the passed function on each member of the collect

merge() public méthode

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 méthode

public next ( )

offsetExists() public méthode

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

offsetGet() public méthode

public offsetGet ( $key )

offsetSet() public méthode

public offsetSet ( $key, $value )

offsetUnset() public méthode

public offsetUnset ( $key )

rewind() public méthode

public rewind ( )

run() public méthode

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

toArray() public méthode

Return an array representation of the Collection.
public toArray ( mixed $keyColumn = null, mixed $valueColumn = null ) : array
$keyColumn mixed
$valueColumn mixed
Résultat array If $keyColumn and $valueColumn are not set, or are both null then this will return the array of entity objects

valid() public méthode

public valid ( )

Property Details

$_entityName protected_oe property

protected $_entityName

$_results protected_oe property

protected $_results

$_resultsIdentities protected_oe property

protected $_resultsIdentities