0

Weird problem I have the following model in which if I call getSystemgoals() from a controller all is well and array of results are returned. Whenever I call getSystemactivities() what appears to be returned is the entire model zend object (see output at end of task)?

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;
}
}

What is returned from getSystemactivities() when called from a controller is :

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) { } } 

Hopefully someone can point me in the right direction the weird thing is when I dump the result from within the model it has the correct result set. Any assistance much appreciated.

Barry Hamilton
  • 943
  • 3
  • 15
  • 35
  • Can you give an example of how you're calling the methods from the controller (working and not), and clarify which of the two methods doesn't work (your question mentions getSystemactivities twice - I assume one of these should be the other method) – Tim Fountain May 25 '13 at 18:35
  • getSystemactivities() doesn't work the other one does, called as $systemactivities = new Account_Model_Systemgoals; $systemactivities->getSystemactivities(); If I var_dump($systemactivities) I get the junk, but if I var_dump($result) in the model method it displays the result set. – Barry Hamilton May 25 '13 at 18:39
  • I have been so dumb, this has had me stumped for 2 hours: should be $systemactivities = new Account_Model_Systemgoals; $systemactivities = $systemactivities->getSystemactivities(); – Barry Hamilton May 25 '13 at 18:54

0 Answers0