123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
-
-
- namespace Doctrine\ORM\Internal\Hydration;
-
-
- class IterableResult implements \Iterator
- {
-
-
- private $_hydrator;
-
-
-
- private $_rewinded = false;
-
-
-
- private $_key = -1;
-
-
-
- private $_current = null;
-
-
-
- public function __construct($hydrator)
- {
- $this->_hydrator = $hydrator;
- }
-
- public function rewind()
- {
- if ($this->_rewinded == true) {
- throw new HydrationException("Can only iterate a Result once.");
- } else {
- $this->_current = $this->next();
- $this->_rewinded = true;
- }
- }
-
-
-
- public function next()
- {
- $this->_current = $this->_hydrator->hydrateRow();
- $this->_key++;
- return $this->_current;
- }
-
-
-
- public function current()
- {
- return $this->_current;
- }
-
-
-
- public function key()
- {
- return $this->_key;
- }
-
-
-
- public function valid()
- {
- return ($this->_current!=false);
- }
- }
|