And put this in your ForumEntry model.

var $order = 'ForumEntry.lft ASC';

On Jul 2, 9:00 pm, Dan Soendergaard <[EMAIL PROTECTED]> wrote:
> Tried that already, it doesn't allow for setting a root node. Also,
> it's deprecated (it's recommended to use Model::find('threaded')
> instead).
>
> On Jul 2, 12:47 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > Try a $this->ForumEntry->findAllThreaded() call. It's part of the
> > Model class.
>
> > Cheers,
> > Adam
>
> > On Jul 2, 7:49 pm, Dan Soendergaard <[EMAIL PROTECTED]> wrote:
>
> > > I'm doing a simple forum which should support nested replies. So, I
> > > decided to use the Tree Behavior.
>
> > > models/forum_entry.php
> > > -----------------------------------------------------------------
> > > <?php
> > > class ForumEntry extends ForumAppModel {
>
> > >         var $name = 'ForumEntry';
> > >         var $displayField = 'subject';
> > >         var $actsAs = array('Tree', 'Containable');
> > >         var $belongsTo = array('User');
>
> > > }
>
> > > ?>
> > > -----------------------------------------------------------------
>
> > > The tree in my database looks like this:
>
> > > - Testing
> > > --- ASubSubject
> > > ------ ASubSubSubject
> > > - Another Subject
>
> > > How do I retrieve a node with parent_id = 0 (like "Testing" or
> > > "Another Subject") and all of its children while preserving the tree
> > > structure?
>
> > > Using $this->ForumEntry->children($id) flattens the tree structure to
> > > this:
>
> > > -----------------------------------------------------------------
> > > Array
> > > (
> > >     [0] => Array
> > >         (
> > >             [ForumEntry] => Array
> > >                 (
> > >                     [id] => 5
> > >                     [parent_id] => 4
> > >                     [lft] => 2
> > >                     [rght] => 5
> > >                     [user_id] => 1
> > >                     [subject] => ASubSubject
> > >                     [body] =>
> > >                     [created] => 2008-07-01 22:58:56
> > >                     [modified] => 2008-07-01 22:58:56
> > >                 )
>
> > >         )
>
> > >     [1] => Array
> > >         (
> > >             [ForumEntry] => Array
> > >                 (
> > >                     [id] => 6
> > >                     [parent_id] => 5
> > >                     [lft] => 3
> > >                     [rght] => 4
> > >                     [user_id] => 1
> > >                     [subject] => ASubSubSubject
> > >                     [body] =>
> > >                     [created] => 2008-07-01 23:16:52
> > >                     [modified] => 2008-07-01 23:16:52
> > >                 )
>
> > >         )
>
> > > )
> > > -----------------------------------------------------------------
>
> > > Suggestions are very much appreciated :) Been wasting a whole day on
> > > this issue now.
>
> > > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to