Its a simple relationship, One article has many comments. I don't even
have users, just simply type in your name. I cannot figuere out how to
access the Article Data from within the ArticleComment

What do I need to do in the add() method to get it to load a list of
comments using the article_id? How would I get this add() method to
work, in general?

And if you were wondering my, end goal is to learn the CakePHP system.
Getting this to work is secondary.

------ ArticleComment model ---------
var $belongsTo = array('Article' =>
                           array('className'  => 'Article',
                                 'conditions' => '',
                                 'order'      => '',
                                 'foreignKey' => 'article_id'
                           )
                     );
----------------------------------------------------


---- ArticleCommentController --------------------------------------
class ArticleCommentController extends AppController {
        var $useTable = 'article_comment';
        var $name = 'ArticleComment';

    function add($article_id) {
        $this->ArticleComment->article_id = $article_id;
        $this->set('comment', $this->ArticleComment->read());

        if (!empty($this->data))
        {

                $this->data['ArticleComment']['date'] =
                    $this->data['ArticleComment']['date_year'] . "-" .
                    $this->data['ArticleComment']['date_month'] . "-" .
                    $this->data['ArticleComment']['date_day'];

            if ($this->Article->save($this->data))
            {
                $this->flash('Your comment has been saved.', '/
article');
            }
        }
    }
}
----------------------------------------


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to