Sunday, October 21, 2012

Re: Copy branch of Tree to another parent

Surely you can just change the parent_id of the top of the branch you want to move? Then let the Tree behaviour take care of the rest.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 21 Oct 2012, at 23:24:53, bs28723 <bill.stoltz@boosterwebsolutions.com> wrote:

Hi,
    I am using the tree behavior for one of my models, and I want to
copy a branch of a tree, with all the sub-branches, leafs etc to another
parent.
It looks like I am going to have to get a list of the children of the
copy from node, and then do a save for each new node.
would it work to do a find('threaded')  clear out all the parent_ids,
set the top node parent_id to the new parent_id, and do a save()?

Is there another way to do this?

Thanks,
bill



View this message in context: Copy branch of Tree to another parent
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate