I have a result set that is the result of a MySQL UNION query. The code I use to retrieve the data is as follows:
$union_select = $PagesTable->getAdapter()->select() ->union(array('(' . $legal_resources_select . ')', '(' . $pages_select . ')')); $PagesTable->getAdapter()->fetchAll($union_select)
$PagesTablegoes on Zend_Db_Table_Abstract. The full selection is too large for publication here, and I do not think that it is relevant to this particular issue. If I am wrong, let me know.
$PagesTable
Zend_Db_Table_Abstract
This currently returns an array of results, but I want it to return a rowset object. I must also indicate $_rowClass. This is necessary, so I can add methods to format and handle the return values.
$_rowClass
Is it possible?
. , , , , , .
Zend_Db_Table - Gateway Table Data , Active Record.
, , , Active Record, Doctrine 1.2, Zend_Db_Table.
, rowClass rowsetClass, Zend_Db_Table,
Zend_Db_Table setRowsetClass setRowClass:
setRowsetClass
setRowClass
class RowTable extends Zend_Db_Table_Abstract { private static $_instance; protected $_name = "tableName"; protected $_primary = "primary_key_id"; # over-write the default class Zend_Db_Table_Rowset_Abstract # make sure the following classes are inside the include-path private function __construct($rowClass, $rowsetClass) { $this->setRowsetClass("ContributionList"); $this->setRowClass("Contribution"); } } $tableObject = new RowTable("RowClass", "RowsetClass");
, , , , , , Zend_Db_Adapter , , Zend_Db_Table::getAdapter, , , , Zend_Db_Table::_fetch, Data Gateway.
Zend_Db_Adapter
Zend_Db_Table::getAdapter
Zend_Db_Table::_fetch
, , , , , .
, , , , getAdapter. , , getAdapter select, , Zend_Db_Select, Zend_Db_Table_Select, Zend_Db_Table::_fetch, fetchAll fetchRow.
getAdapter
Zend_Db_Select
Zend_Db_Table_Select
fetchAll
fetchRow
.