Zend_Db_Table_Row 是一个对象。如果你调用 fetchAll() 它将返回一个 Zend_Db_Table_Row 类型的 Objects 数组(列名是受保护的变量,访问 $row->column)。如果你调用 fetchRow() 它将返回一个 Zend_Db_Table_Row 对象。
例如:
//assume we are working inside a Application_Model_DbTable_
public function fetch() {
$select = $this->select();
//here $result would return an array of Row objects that can be iterated over using a foreach
$result = $this->fetchAll($select);
//here we would return a single Row Object
$select->where('id = ?', $id);
$result = $this->fetchRow($select);
//you can call toArray() on these objects if you need an array
$array = $result->toArray();
}
//if you are using these objects in your application you can always access any of the
//columns using normal object syntax, without the underscores.
$id = $result->id;
$name = $result->name;
如果您使用 Zend_Db_Adapter 或 Zend_Db_Statement 进行查询,您可能会有一些不同的行为。
我希望我正确理解了你的问题。