ZF-836: Zend_Db_Table::fetchCount($where = null) - fetching number of row results
Description
i've wanted to count row results to build a nice helper which organizes my index-views more comfortable.
so i've added ..
/**
* Fetches the number of row results.
*
* @return int The number of row results
*/
public function fetchCount($where = null)
{
return (int)$this->_fetch('Count', $where);
}
.. and changed ..
// the FROM clause
$select->from($this->_name, array_keys($this->_cols));
.. to ..
// the FROM clause
if ($type == 'Count') {
$select->from($this->_name, 'count(*)');
$type = 'One';
}
else
$select->from($this->_name, array_keys($this->_cols));
.. which gives me a Zend_Db_Table::fetchCount($where)-function returning the number of row results :)
Comments
Posted by Wil Sinclair (wil) on 2008-03-25T20:43:58.000+0000
Please categorize/fix as needed.
Posted by Wil Sinclair (wil) on 2008-04-18T13:11:56.000+0000
This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
Posted by Wil Sinclair (wil) on 2008-12-04T13:17:31.000+0000
Reassigning to Ralph since he's the new maintainer of Zend_Db
Posted by Ralph Schindler (ralph) on 2009-01-09T12:36:17.000+0000
A solution exists for this in this issue:
http://framework.zend.com/issues/browse/ZF-1335