0
我有一個擴展Zend_Db_Table_Abstract
類內部時,下面的代碼:改變Zend_Db_Select對象的輸出Zend_Db_Table_Rowset
public function fetchByFriends($id) {
/*
* SELECT * FROM list
* INNER JOIN friendship ON
* list.user_id = friendship.friend_id
* WHERE friendship.user_id = ?
*/
$select = $this->select()
->from("list")
->join("friendship", "list.user_id = friendship.friend_id")
->where("friendship.user_id = ?", $id);
$select->setIntegrityCheck(false); // allows joins within a DbTable
$stmt = $select->query();
return $this->fetchAll($stmt);
}
雖然查詢工作正常返回的數據是一個數組的。有沒有什麼方法來重構這個,以便fetchAll
將它作爲Zend_Db_Table_Rowset
返回,而不是數組?