zendframework/zf2 — pull request #1225 by dgasparri (2012-05-14 13:22:57+00:00)
Title: [ZF2-281] && [ZF2-262] Cannot Count rows in a MySQLi Result Set /

( @ralphschindler finally manged to get it into a clean pull request, thank you for your help!)

It solves issues http://framework.zend.com/issues/browse/ZF2-262 and http://framework.zend.com/issues/browse/ZF2-281 (both are about the Myiqli Result Iterator)

See pull #1201 https://github.com/zendframework/zf2/pull/1201 for part of the discussion.

Ralph, I didn't mean that count() was part of the Iterator, but they both depends (somehow) on the same issue. The iterator gives the developer the possibility to run through the set as many time as he wants (I stumbled on those issues because I needed to do two foreach to properly show a reversed table with indexes as columns). I found the count() method (and Countable interface) already implemented when I started working on it, so if we provide it, let's make it work, one way or another.

Honestly, I'm starting to feel that there's too redundancy between Result and ResultSet, with the latter doing very little. Both are Countable, both are Itarator...