PHP Class Bravo3\Orm\Query\QueryResult

Inheritance: implements Countable, implements Iterator, implements ArrayAccess
Show file Open project: bravo3/orm

Protected Properties

Property Type Description
$entities array
$entity_manager Bravo3\Orm\Services\EntityManager
$full_size integer
$id_list string[]
$iterator ArrayIterator
$query Bravo3\Orm\Query\QueryInterface
$use_cache boolean

Public Methods

Method Description
__construct ( EntityManager $entity_manager, Bravo3\Orm\Query\QueryInterface $query, array $results, $full_size = null, $use_cache = true )
count ( ) : integer Result set size
current ( ) : object Return the current entity
getEntityById ( string $id ) : object | null Return an entity from the results by its ID
getFullSize ( ) : integer Get the full size of the query, without any limits applied to it
getIdList ( ) : string[] Get the full list of IDs returned in the query
getQuery ( ) : Bravo3\Orm\Query\QueryInterface Get the search query
key ( ) : mixed Get the key of the current element
next ( ) Move forward to the next entity
offsetExists ( integer $offset ) : boolean Check if an ID is in the result set
offsetGet ( integer $offset ) : object Retrieve the entity at position $offset
offsetSet ( integer $offset, mixed $value ) You cannot set query elements, calling this function will throw a \LogicException
offsetUnset ( integer $offset ) You cannot unset query elements, calling this function will throw a \LogicException
rewind ( ) Rewind the Iterator to the first element
valid ( ) : boolean Checks if current position is valid

Private Methods

Method Description
hydrateEntity ( string $id ) Hydrate an entity

Method Details

__construct() public method

public __construct ( EntityManager $entity_manager, Bravo3\Orm\Query\QueryInterface $query, array $results, $full_size = null, $use_cache = true )
$entity_manager Bravo3\Orm\Services\EntityManager
$query Bravo3\Orm\Query\QueryInterface
$results array

count() public method

Result set size
public count ( ) : integer
return integer

current() public method

Return the current entity
public current ( ) : object
return object

getEntityById() public method

Return an entity from the results by its ID
public getEntityById ( string $id ) : object | null
$id string
return object | null

getFullSize() public method

This information may not be available, and should be explicitly requested when creating the query.
public getFullSize ( ) : integer
return integer

getIdList() public method

Get the full list of IDs returned in the query
public getIdList ( ) : string[]
return string[]

getQuery() public method

Get the search query
public getQuery ( ) : Bravo3\Orm\Query\QueryInterface
return Bravo3\Orm\Query\QueryInterface

key() public method

Get the key of the current element
public key ( ) : mixed
return mixed scalar on success, or null on failure.

next() public method

Move forward to the next entity
public next ( )

offsetExists() public method

Check if an ID is in the result set
public offsetExists ( integer $offset ) : boolean
$offset integer
return boolean

offsetGet() public method

Retrieve the entity at position $offset
public offsetGet ( integer $offset ) : object
$offset integer
return object

offsetSet() public method

You cannot set query elements, calling this function will throw a \LogicException
public offsetSet ( integer $offset, mixed $value )
$offset integer
$value mixed

offsetUnset() public method

You cannot unset query elements, calling this function will throw a \LogicException
public offsetUnset ( integer $offset )
$offset integer

rewind() public method

Rewind the Iterator to the first element
public rewind ( )

valid() public method

Checks if current position is valid
public valid ( ) : boolean
return boolean Returns true on success or false on failure.

Property Details

$entities protected property

protected array $entities
return array

$entity_manager protected property

protected EntityManager,Bravo3\Orm\Services $entity_manager
return Bravo3\Orm\Services\EntityManager

$full_size protected property

protected int $full_size
return integer

$id_list protected property

protected string[] $id_list
return string[]

$iterator protected property

protected ArrayIterator $iterator
return ArrayIterator

$query protected property

protected QueryInterface,Bravo3\Orm\Query $query
return Bravo3\Orm\Query\QueryInterface

$use_cache protected property

protected bool $use_cache
return boolean