Tuesday, March 3, 2009

undetermined recursion

hello, i'm experimenting with models relationships with a blog sample
application.
Post hasMany Comment and Comment hasMany Comments i.e. replies. In
order to retrieve all posts with relative comments and replies to
comments i should set $recursive = x, not knowing the depth of the
replies.
Examples
Post A has 2 comments B and C. B has two replies D and F. F has one
reply G. with $recursive = 2 i'd get all replies up to G, but if G
gets replies i should increment the recursion level in order to get
them.
Same problem implementing Conteinable behaviour ('contain' => array
('Comment','Comment.Comment', 'Comment.Comment.Comment[...])
Is there a way to get an undetermined recursion or to change it
programmatically?
relationships are implemented in the db with a post_id foreign key and
a parend_id key in the comment table, if a parent_id is set there's no
post_id.

Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: