It also provides a simple caching mechanism which stores the result after the first load. You are then free to iterate over the result back and forth through the provided methods and don't have to think about hitting the database too often. On initialization, it needs a PDOStatement to operate on. You are then free to use all methods provided by the Iterator interface.
Inheritance: extends lithium\data\source\Result
Beispiel #1
0
 public function testKey()
 {
     $resource = $this->_db->connection->query("SELECT id, name FROM galleries;");
     $result = new Result(compact('resource'));
     $this->assertIdentical(0, $result->key());
     $result->next();
     $this->assertIdentical(1, $result->key());
     $result->next();
     $this->assertIdentical(null, $result->key());
 }