Tuesday, July 31, 2012

Re: Attempting to reparent a TreeBehavior node -- assign new parent_id, lft, and rght values

On Mon, Jul 30, 2012 at 5:58 PM, Kevin Mitchell <kevin@ncbible.com> wrote:
>
> public function reparent($id=null) {
> $this->TopicTree->id = $id;
> $newParentId = 51191;
> $this->TopicTree->save(array('parent_id' => $newParentId));
> }

I'm no expert but I think that should work. Without diving into the
source, the only suggestion I have is to ensure that there is in fact
a row in the DB with id = 51911.

> CakePHP just spins its wheels; nothing happens.

What do you mean by "spins its wheels"? Is this a controller action or
model method? If the former, perhaps you're missing a redirect? If the
latter, should it be returning something?

> I assume this will only work with a model that has $actsAs =
> array('Tree').

Yes, of course.

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

No comments: