przewiń do treści

Zend Framework od podstaw

Włodzimierz Gajda

public function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
    if ($where === null) {
        $select = $this->select();
    } else if (!($where instanceof Zend_Db_Table_Select)) {
        $select = $this->select();

        if ($where !== null) {
            $this->_where($select, $where);
        }

        if ($order !== null) {
            $this->_order($select, $order);
        }

        if ($count !== null || $offset !== null) {
            $select->limit($count, $offset);
        }

    } else {
        $select = $where;
    }

    $select->order('wysokosc DESC');

    return parent::fetchAll($select, $order, $count, $offset);
}

Listing 16.2. Metoda fetchAll(), którą należy dodać w klasie z listingu 16.1

Rozdział 16. Dostosowywanie klas dostępu do bazy danych

listing-16-02.txt