implements Phalcon\Mvc\Model\ResultsetInterface, Iterator, Traversable, SeekableIterator, Countable, ArrayAccess, Serializable, JsonSerializable
This component allows to Phalcon\Mvc\Model returns large resultsets with the minimum memory consumption Resultsets 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(["type='virtual'", 'order' => 'name']); foreach ($robots as robot) { echo robot->name, "\n"; } // Using a while $robots = Robots::find(["type='virtual'", 'order' => 'name'); $robots->rewind(); while ($robots->valid()) { $robot = $robots->current(); echo $robot->name, "\n"; $robots->next(); }
Phalcon\Mvc\Model\Resultset constructor
Moves cursor to next row in the resultset
Check whether internal resource has rows to fetch
Gets pointer number of active row in the resultset
Rewinds resultset to its beginning
Changes internal pointer to a specific position in the resultset Set new position if required and set this->_row
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 the error messages produced by a batch operation
Updates every record in the resultset
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 serialised model objects as array for json_encode. Calls jsonSerialize on each object if present
$robots = Robots::find(); echo json_encode($robots);
...
...
...
...
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Resultset.html