Zend_Loader::loadClass('Zend_Db_Table');
class SomeTable extends Zend_Db_Table_Abstract{
protected $_name = 'sometable';
public function getAssoc($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;
}
return $this->getAdapter()->fetchAssoc($select);
}
}
Sonra kodu:
$this->some_table = new SomeTable();
//Get and print some row(s)
$where = $this->some_table->getAdapter()->quoteInto('primarykey_name = ?', $primarykey_value);
print_r($this->somes_table->getAssoc($where));
//Get and print all rows
print_r($this->areas_table->getAssoc());