implements Phalcon\Mvc\Model\ResultsetInterface, Iterator, Traversable, SeekableIterator, Countable, ArrayAccess, Serializable
This component allows to Phalcon\Mvc\Model returns large resulsets with the minimum memory consumption Resulsets can be traversed using a standard foreach or a while statement. If a resultset is serialized it will dump all the rows into a big array. Then unserialize will retrieve the rows as they were before serializing.
//Using a standard foreach $robots = Robots::find(array("type='virtual'", "order" => "name")); foreach ($robots as $robot) { echo $robot->name, "\n"; } //Using a while $robots = Robots::find(array("type='virtual'", "order" => "name")); $robots->rewind(); while ($robots->valid()) { $robot = $robots->current(); echo $robot->name, "\n"; $robots->next(); }
Moves cursor to next row in the resultset
Gets pointer number of active row in the resultset
Rewinds resultset to its beginning
Changes internal pointer to a specific position in the resultset
Counts how many rows are in the resultset
Checks whether offset exists in the resultset
Gets row in a specific position of the resultset
Resultsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface
Resultsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface
Returns the internal type of data retrieval that the resultset is using
Get first row in the resultset
Get last row in the resultset
Set if the resultset is fresh or an old one cached
Tell if the resultset if fresh or an old one cached
Sets the hydration mode in the resultset
Returns the current hydration mode
Returns the associated cache for the resultset
Returns current row in the resultset
Returns the error messages produced by a batch operation
Deletes every record in the resultset
Filters a resultset returning only those the developer requires
$filtered = $robots->filter(function($robot){ if ($robot->id < 3) { return $robot; } });
Returns a complete resultset as an array, if the resultset has a big number of rows it could consume more memory than currently it does.
...
...
...
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Mvc_Model_Resultset.html