Note that there are some explanatory texts on larger screens.

plurals
  1. POzend db returns junk when called from controller but when result dumped in the model it is fine
    text
    copied!<p>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)?</p> <pre><code>class Account_Model_Systemgoals extends Zend_Db_Table_Abstracter { protected $_options = 'goaloptions'; protected $_systemgoals ='system_goals'; protected $_actions = 'actions'; public function getSystemgoals() { $select = $this-&gt;_db-&gt;select() -&gt;from($this-&gt;_systemgoals); $result = $this-&gt;_db-&gt;fetchAll($select); return $result; } public function getSystemactivities() { $select = $this-&gt;_db-&gt;select() -&gt;from($this-&gt;_actions); $result = $this-&gt;_db-&gt;fetchAll($select); return $result; } } </code></pre> <p>What is returned from getSystemactivities() when called from a controller is :</p> <pre><code>object(Account_Model_Systemgoals)#66 (21) { ["_options":protected]=&gt; string(11) "goaloptions" ["_systemgoals":protected]=&gt; string(12) "system_goals" ["_actions":protected]=&gt; string(7) "actions" ["_definition":protected]=&gt; NULL ["_definitionConfigName":protected]=&gt; NULL ["_db":protected]=&gt; object(Zend_Db_Adapter_Pdo_Mysql)#8 (12) { ["_pdoType":protected]=&gt; string(5) "mysql" ["_numericDataTypes":protected]=&gt; array(16) { [0]=&gt; int(0) [1]=&gt; int(1) [2]=&gt; int(2) ["INT"]=&gt; int(0) ["INTEGER"]=&gt; int(0) ["MEDIUMINT"]=&gt; int(0) ["SMALLINT"]=&gt; int(0) ["TINYINT"]=&gt; int(0) ["BIGINT"]=&gt; int(1) ["SERIAL"]=&gt; int(1) ["DEC"]=&gt; int(2) ["DECIMAL"]=&gt; int(2) ["DOUBLE"]=&gt; int(2) ["DOUBLE PRECISION"]=&gt; int(2) ["FIXED"]=&gt; int(2) ["FLOAT"]=&gt; int(2) } ["_defaultStmtClass":protected]=&gt; string(21) "Zend_Db_Statement_Pdo" ["_config":protected]=&gt; array(8) { ["host"]=&gt; string(9) "localhost" ["username"]=&gt; string(4) "root" ["password"]=&gt; string(0) "" ["dbname"]=&gt; string(15) "lawcountability" ["charset"]=&gt; NULL ["persistent"]=&gt; bool(false) ["options"]=&gt; array(3) { ["caseFolding"]=&gt; int(0) ["autoQuoteIdentifiers"]=&gt; bool(true) ["fetchMode"]=&gt; int(2) } ["driver_options"]=&gt; array(0) { } } ["_fetchMode":protected]=&gt; int(2) ["_profiler":protected]=&gt; object(Zend_Db_Profiler)#9 (4) { ["_queryProfiles":protected]=&gt; array(0) { } ["_enabled":protected]=&gt; bool(false) ["_filterElapsedSecs":protected]=&gt; NULL ["_filterTypes":protected]=&gt; NULL } ["_defaultProfilerClass":protected]=&gt; string(16) "Zend_Db_Profiler" ["_connection":protected]=&gt; object(PDO)#53 (0) { } ["_caseFolding":protected]=&gt; int(0) ["_autoQuoteIdentifiers":protected]=&gt; bool(true) ["_allowSerialization":protected]=&gt; bool(true) ["_autoReconnectOnUnserialize":protected]=&gt; bool(false) } ["_schema":protected]=&gt; NULL ["_name":protected]=&gt; string(25) "Account_Model_Systemgoals" ["_cols":protected]=&gt; NULL ["_primary":protected]=&gt; NULL ["_identity":protected]=&gt; int(1) ["_sequence":protected]=&gt; bool(true) ["_metadata":protected]=&gt; array(0) { } ["_metadataCache":protected]=&gt; NULL ["_metadataCacheInClass":protected]=&gt; bool(true) ["_rowClass":protected]=&gt; string(17) "Zend_Db_Table_Row" ["_rowsetClass":protected]=&gt; string(20) "Zend_Db_Table_Rowset" ["_referenceMap":protected]=&gt; array(0) { } ["_dependentTables":protected]=&gt; array(0) { } ["_defaultSource":protected]=&gt; string(11) "defaultNone" ["_defaultValues":protected]=&gt; array(0) { } } </code></pre> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload