There are two tables involved

articles
- id
- title
- text

comments
- name
- comment
- article_id

Now I have a form by an article, so users can post comments

The code is quite simple...

    public function showAction() {
                $articlesTable = new Articles;
                $article = $articlesTable->fetchRow("REPLACE(title, ' ', '-') = 
'" .
$this->_getParam('article') . "'");

                // comments
                $this->view->comments = $article->findComments();
                
                // comment form
                // create form.....
                     
                $this->view->form = $form;
                
                if($this->getRequest()->isPost()) {
                        
                        if($form->isValid($_POST)) {
                                $commentsTable = new Comments();
                                $comment = 
$commentsTable->createRow($form->getValues());
                                $comment->article_id = $article->id;
                                $comment->save();
                        }
                }
                
        }

when I post a comment I get: "Cannot refresh row as parent is missing"
stack trace:
#0 ...\library\Zend\Db\Table\Row\Abstract.php(475):
Zend_Db_Table_Row_Abstract->_refresh()
....

But the comment is saved in the right way..

How can I solve this?

Thanks for your help
-- 
View this message in context: 
http://www.nabble.com/Saving-a-new-comment-by-an-article-tp21873432p21873432.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to