On Oct 15, 10:41 am, "Constantin.FF" <[email protected]> wrote:
> I have this data in the database with tree behavior attached to the
> model. So in the first example I would like to reorder the tree as
> follows: Bear - Emo - Toivo - Inlove - Broakenheart. This simple one
> move i can do with moveUp or moveDown. But more often I need to move
> the items more complexly for example: Broakenheart - Emo - Bear -
> Inlove - Toivo. I guess that if I insert one more column with the
> index of this sorting , it can be done , but can it be done without
> this extra column?

Why would you want to add /another/ column?

As there is no logic to the order you describe you cannot use reorder
- call moveDown($id, true) for all children with the $id of each key
and the result will be the lft values are in the order you want.

i.e.

foreach($idsInDesiredOrder as $id) {
  $this->moveDown($id, true);
}

As you're already read the docblock/api entry for moveDown you can see
that'll do what you asked.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to