title: Fatal error when I am using toArray() in zend framework
body: <p>I need help to remove fatal error of <code>toArray()</code> in zend framework.</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function toArray() on a non-object</p>
  </blockquote>
  
  <p>I am using following code in my controller</p>
  
  <pre><code>$obj     = new Admin_Model_UserMapper();
  $where   = array('id = ?'=&gt;$decryptId);
  $data    = $obj-&gt;fetchAll($where);
  //  $currentData = $data-&gt;current();
  $dataArr = $data-&gt;toArray();
  
  
  $form = new Admin_Form_UserForm();
  $form-&gt;setAction('edit-user');
  $form-&gt;populate($dataArr);
  </code></pre>
  
  <p>I am getting fatal error in both condition when I use <code>toArray()</code> or <code>current()</code>. </p>
  
  <p>I have already used following code, but not getting any solution and it produces the same error:</p>
  
  <pre><code>$db = Zend_Db_Table::getDefaultAdapter();
  $select = $db-&gt;select()-&gt;from('user')-&gt;where('id= ?',$decryptId);
  $stmt = $select-&gt;query();
  $result = $stmt-&gt;fetchAll();
  if(count($result) &gt; 0){
      $dataArr = $result-&gt;toArray();
  } 
  </code></pre>
  
  <p>How can I resolve this?</p>