Zend_Db_Table_Abstract::fetchAll PHP Method

fetchAll() public method

Honors the Zend_Db_Adapter fetch mode.
public fetchAll ( string | array | Zend_Db_Table_Select $where = null, string | array $order = null, integer $count = null, integer $offset = null ) : Zend_Db_Table_Rowset_Abstract
$where string | array | Zend_Db_Table_Select OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
$order string | array OPTIONAL An SQL ORDER clause.
$count integer OPTIONAL An SQL LIMIT count.
$offset integer OPTIONAL An SQL LIMIT offset.
return Zend_Db_Table_Rowset_Abstract The row results per the Zend_Db_Adapter fetch mode.
    public function fetchAll($where = null, $order = null, $count = null, $offset = null)
    {
        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;
        }
        $rows = $this->_fetch($select);
        $data = array('table' => $this, 'data' => $rows, 'readOnly' => $select->isReadOnly(), 'rowClass' => $this->getRowClass(), 'stored' => true);
        $rowsetClass = $this->getRowsetClass();
        if (!class_exists($rowsetClass)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($rowsetClass);
        }
        return new $rowsetClass($data);
    }

Usage Example

Exemplo n.º 1
0
 public function fetchAll()
 {
     $resultSet = $this->dbTable->fetchAll();
     $entries = array();
     foreach ($resultSet as $row) {
         $entries[] = array('id' => $row->id, 'state' => $row->state, 'info' => $row->info, 'lastupdate' => $row->lastupdate, 'sticked' => $row->sticked);
     }
     return $entries;
 }
All Usage Examples Of Zend_Db_Table_Abstract::fetchAll