PHP Interface Nextras\Orm\Collection\ICollection

Inheritance: extends IteratorAggregat\IteratorAggregate, extends Countabl\Countable
Exibir arquivo Open project: nextras/orm Interface Usage Examples

Public Methods

Method Description
countStored ( ) : integer Counts collection entities without fetching them from storage.
fetch ( ) : Nextras\Orm\Entity\IEntity | null Fetches the first row.
fetchAll ( ) : Nextras\Orm\Entity\IEntity[] Fetches all records.
fetchPairs ( string $key = null, string $value = null ) : array Fetches all records like $key => $value pairs.
findBy ( array $where ) : Nextras\Orm\Collection\ICollection Returns entity collection filtered by conditions.
getBy ( array $where ) : Nextras\Orm\Entity\IEntity | null Returns IEntity filtered by conditions.
getEntityCount ( Nextras\Orm\Entity\IEntity $parent = null ) : integer
getEntityIterator ( Nextras\Orm\Entity\IEntity $parent = null ) : Traversable
getRelationshipMapper ( ) : Nextras\Orm\Mapper\IRelationshipMapper
limitBy ( integer $limit, integer $offset = null ) : Nextras\Orm\Collection\ICollection Limits number of rows.
orderBy ( string | array $column, string $direction = self::ASC ) : Nextras\Orm\Collection\ICollection Selects columns to order by.
resetOrderBy ( ) : Nextras\Orm\Collection\ICollection Resets collection ordering.
setRelationshipMapping ( Nextras\Orm\Mapper\IRelationshipMapper $mapper = null, Nextras\Orm\Entity\IEntity $parent = null ) : self Sets relationship mapping over collection.

Method Details

countStored() public method

Counts collection entities without fetching them from storage.
public countStored ( ) : integer
return integer

fetch() public method

Fetches the first row.
public fetch ( ) : Nextras\Orm\Entity\IEntity | null
return Nextras\Orm\Entity\IEntity | null

fetchAll() public method

Fetches all records.
public fetchAll ( ) : Nextras\Orm\Entity\IEntity[]
return Nextras\Orm\Entity\IEntity[]

fetchPairs() public method

Fetches all records like $key => $value pairs.
public fetchPairs ( string $key = null, string $value = null ) : array
$key string associative key
$value string value
return array

findBy() public method

Returns new instance of collection.
public findBy ( array $where ) : Nextras\Orm\Collection\ICollection
$where array
return Nextras\Orm\Collection\ICollection

getBy() public method

Returns IEntity filtered by conditions.
public getBy ( array $where ) : Nextras\Orm\Entity\IEntity | null
$where array
return Nextras\Orm\Entity\IEntity | null

getEntityCount() public method

public getEntityCount ( Nextras\Orm\Entity\IEntity $parent = null ) : integer
$parent Nextras\Orm\Entity\IEntity
return integer

getEntityIterator() public method

public getEntityIterator ( Nextras\Orm\Entity\IEntity $parent = null ) : Traversable
$parent Nextras\Orm\Entity\IEntity
return Traversable

getRelationshipMapper() public method

public getRelationshipMapper ( ) : Nextras\Orm\Mapper\IRelationshipMapper
return Nextras\Orm\Mapper\IRelationshipMapper

limitBy() public method

Limits number of rows.
public limitBy ( integer $limit, integer $offset = null ) : Nextras\Orm\Collection\ICollection
$limit integer
$offset integer
return Nextras\Orm\Collection\ICollection

orderBy() public method

Returns new instance of collection.
public orderBy ( string | array $column, string $direction = self::ASC ) : Nextras\Orm\Collection\ICollection
$column string | array column name or array of column names
$direction string sorting direction self::ASC or self::DESC
return Nextras\Orm\Collection\ICollection

resetOrderBy() public method

Resets collection ordering.
public resetOrderBy ( ) : Nextras\Orm\Collection\ICollection
return Nextras\Orm\Collection\ICollection

setRelationshipMapping() public method

Sets relationship mapping over collection.
public setRelationshipMapping ( Nextras\Orm\Mapper\IRelationshipMapper $mapper = null, Nextras\Orm\Entity\IEntity $parent = null ) : self
$mapper Nextras\Orm\Mapper\IRelationshipMapper
$parent Nextras\Orm\Entity\IEntity
return self