ZF-4486: PDOStatement is of type Traversable, Zend_Db_Statement should be an Iterator
Description
PDOStatement has type Traversable. This is a php-internal type. To my surprise Zend_Db_Statement doesn't expose this interface. I expect at least Zend_Db_Statement_Pdo to be iterative. Iterator extends Traversable and this interface can be used in userland code. Implementing the Iterator interface for Zend_Db_Statement would solve this discrepancy. We can throw an NotImplementedException for rewind().
Comments
Posted by julien PAULI (doctorrock83) on 2008-11-27T08:01:24.000+0000
Perhaps we could use IteratorAggregate.
The getIterator() method could then return the PDOStatement, as return $this->_stmt
Posted by julien PAULI (doctorrock83) on 2008-12-19T06:48:55.000+0000
Something like this works :
But I don't know if that is THE solution.
Posted by julien PAULI (doctorrock83) on 2008-12-22T00:34:37.000+0000
r13420 adds the improvement