Brian and  delocalizer

I made the changes to the User model as you suggested but it made no
difference to the dubug.  The ChildComment and User tables are still
not associated when I retrieve the comment data.

I think the missing link is I need to somehow define a belongsTo link
from the ChildComment to the User model?  How do I do this?  Is this
done in the comment.php model file or a new child_comment.php file?

I had a look at the tree helper but I'm not sure how this will resove
the problem of the association between the ChildComment and User
models.  It will build the relationships between each comment but I'm
not sure how it will help with the association between the
ChildComments and User data.  I'll need to have a play with it and get
back to you.

Thanks for your help.


On Aug 26, 12:57 am, brian <bally.z...@gmail.com> wrote:
> On Tue, Aug 25, 2009 at 6:43 AM,gedm<gerard.me...@gmail.com> wrote:
>
> > Brian,
>
>
> I see now. Try doing this for the User model:
>
> var $hasMany = array(
>            'Comment' => array(
>                            'className' => 'Comment',
>                            'foreignKey' => 'user_id',
>                            'dependent' => true
>            ),
>            'ParentComment' => array(
>                            'className' => 'Comment',
>                            'foreignKey' => 'user_id',
>                            'dependent' => true
>            ),
>            'ChildComment' => array(
>                            'className' => 'Comment',
>                            'foreignKey' => 'user_id',
>                            'dependent' => true
>            )
> );
>
> I think that might work. Note that I set dependent = true here. This
> will remove all Comments that belong to a User if the latter is
> deleted. You'd likely want to do the same for, say, an Article model,
> or whatever it is that these Comments belong to besides User.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to