当从控制器调用时,zend db返回垃圾,但当结果转储到模型中时,它很好

时间:2013-05-25 17:46:50

标签: zend-framework zend-db

奇怪的问题我有以下模型,如果我从控制器调用getSystemgoals()一切都很好,并返回结果数组。 每当我调用getSystemactivities()时,似乎返回的是整个模型的zend对象(参见任务结束时的输出)?

class Account_Model_Systemgoals extends Zend_Db_Table_Abstracter
{
protected $_options = 'goaloptions';
protected $_systemgoals ='system_goals';
protected $_actions = 'actions';
public function getSystemgoals()
{   
$select = $this->_db->select()
->from($this->_systemgoals);

$result = $this->_db->fetchAll($select);

return $result;
}
public function getSystemactivities()
{   
$select = $this->_db->select()  
->from($this->_actions);    
$result = $this->_db->fetchAll($select);    
return $result;
}
}

从控制器调用时从getSystemactivities()返回的内容是:

object(Account_Model_Systemgoals)#66 (21) { ["_options":protected]=> string(11) "goaloptions" ["_systemgoals":protected]=> string(12) "system_goals" ["_actions":protected]=> string(7) "actions" ["_definition":protected]=> NULL ["_definitionConfigName":protected]=> NULL ["_db":protected]=> object(Zend_Db_Adapter_Pdo_Mysql)#8 (12) { ["_pdoType":protected]=> string(5) "mysql" ["_numericDataTypes":protected]=> array(16) { [0]=> int(0) [1]=> int(1) [2]=> int(2) ["INT"]=> int(0) ["INTEGER"]=> int(0) ["MEDIUMINT"]=> int(0) ["SMALLINT"]=> int(0) ["TINYINT"]=> int(0) ["BIGINT"]=> int(1) ["SERIAL"]=> int(1) ["DEC"]=> int(2) ["DECIMAL"]=> int(2) ["DOUBLE"]=> int(2) ["DOUBLE PRECISION"]=> int(2) ["FIXED"]=> int(2) ["FLOAT"]=> int(2) } ["_defaultStmtClass":protected]=> string(21) "Zend_Db_Statement_Pdo" ["_config":protected]=> array(8) { ["host"]=> string(9) "localhost" ["username"]=> string(4) "root" ["password"]=> string(0) "" ["dbname"]=> string(15) "lawcountability" ["charset"]=> NULL ["persistent"]=> bool(false) ["options"]=> array(3) { ["caseFolding"]=> int(0) ["autoQuoteIdentifiers"]=> bool(true) ["fetchMode"]=> int(2) } ["driver_options"]=> array(0) { } } ["_fetchMode":protected]=> int(2) ["_profiler":protected]=> object(Zend_Db_Profiler)#9 (4) { ["_queryProfiles":protected]=> array(0) { } ["_enabled":protected]=> bool(false) ["_filterElapsedSecs":protected]=> NULL ["_filterTypes":protected]=> NULL } ["_defaultProfilerClass":protected]=> string(16) "Zend_Db_Profiler" ["_connection":protected]=> object(PDO)#53 (0) { } ["_caseFolding":protected]=> int(0) ["_autoQuoteIdentifiers":protected]=> bool(true) ["_allowSerialization":protected]=> bool(true) ["_autoReconnectOnUnserialize":protected]=> bool(false) } ["_schema":protected]=> NULL ["_name":protected]=> string(25) "Account_Model_Systemgoals" ["_cols":protected]=> NULL ["_primary":protected]=> NULL ["_identity":protected]=> int(1) ["_sequence":protected]=> bool(true) ["_metadata":protected]=> array(0) { } ["_metadataCache":protected]=> NULL ["_metadataCacheInClass":protected]=> bool(true) ["_rowClass":protected]=> string(17) "Zend_Db_Table_Row" ["_rowsetClass":protected]=> string(20) "Zend_Db_Table_Rowset" ["_referenceMap":protected]=> array(0) { } ["_dependentTables":protected]=> array(0) { } ["_defaultSource":protected]=> string(11) "defaultNone" ["_defaultValues":protected]=> array(0) { } } 

希望当我从模型中转储具有正确结果集的结果时,有人可以指出我正确的方向。 任何帮助都非常赞赏。

0 个答案:

没有答案