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

Please categorize/fix as needed.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Reassigning to Ralph since he's the new maintainer of Zend_Db

A solution exists for this in this issue:

http://framework.zend.com/issues/browse/ZF-1335