Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot refresh row as parent is missing. Zend Framework
    text
    copied!<p>i am getting the error "Cannot refresh row as parent is missing" when I try to save. Here is my code</p> <pre><code>abstract class Webapp_Model_Resource_Db_Table_Abstract extends Zend_Db_Table_Abstract { /** * Save a row to the database * * * @param array $info The data to insert/update * @param Zend_DB_Table_Row $row Optional The row to use * @return mixed The primary key */ public function saveRow($info, $row = null) { if (null === $row) { $row = $this-&gt;createRow(); } $columns = $this-&gt;info('cols'); foreach ($columns as $column) { if (array_key_exists($column, $info)) { $row-&gt;$column = $info[$column]; } } return $row-&gt;save(); } } </code></pre> <p>when I call the saveRow() method, I pass in the $_POST values ($form->getValues())</p> <p>I have reused this class with my other modules in the same application but now I am getting this error and I am not sure why. My table is pretty straight forward:</p> <pre><code>CREATE TABLE `news` ( `id` int(11) NOT NULL AUTO_INCREMENT, `headline` varchar(100) DEFAULT NULL, `snippet` varchar(500) DEFAULT NULL, `full_text` text, `author` varchar(100) DEFAULT NULL, `publish_from` date DEFAULT NULL COMMENT 'Publish date', `publish_to` date DEFAULT NULL COMMENT 'Take it down or mark as draft after this date', `datecreated` timestamp NULL DEFAULT NULL COMMENT 'First created on', `revised` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp for the last time it was revised', `draft` tinyint(1) DEFAULT '0' COMMENT 'Should not be published', `departments_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8 COMMENT='Stores news articles'; </code></pre> <p>Anyone know what I am doing wrong?</p> <p>::::::::::::::ADDTION:::::::::::::</p> <pre><code>public function saveNews($post,$defaults = array()) { //get the form $form = $this-&gt;getForm('article' . ucfirst($validator)); //validate if(!$form-&gt;isValid($post)) { return false; } //get fitered values $data = $form-&gt;getValues(); //apply defaults foreach($defaults as $col =&gt; $value) { $data[$col] = $value; } //get the article if it exists $article = array_key_exists('id', $data) ? $this-&gt;getNewsById($data['id']) : null; return $this-&gt;saveRow($data, $article); } </code></pre>
 

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