I guess nobody know of an easy way to do this?
nobody has ever written a routine to do this?
Last hope before I dive into this....
Thanks
Bill

On 10/22/2012 8:18 AM, Bill Stoltz wrote:
> Sorry, if my question was not clear.
>
> I want to "copy" the entire branch to another location.  So, if I want 
> to copy a branch that has 5 children,
> then I need to create the new parent node first, then once I have this 
> ID, I can then create the 5 children nodes.
> That is a fairly easy example.  But what about a branch that has 4 
> levels and 5 nodes?
>
> Is seems like I have to walk the original tree and create each node, 
> then sub-node, then leaf, etc, etc.
> Anyone done this before? Any suggestions?
>
> Example - Before Copy
> Root
> |--Node1
> |    |-- Node2
> |    |-- Node3
> |          |--Node4
> |                |--Node5
> |--Node6
>      |--Node7
>
> After Copy
> Root
> |--Node1
> |    |-- Node2
> |    |-- Node3
> |          |--Node4
> |                |--Node5
> |--Node6
>      |--Node7
>           |--Node1
>                |-- Node2
>                |-- Node3
>                      |--Node4
>                            |--Node5
>
> On 10/22/2012 12:27 AM, Jeremy Burns | Class Outfit [via CakePHP] wrote:
>> 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 <[hidden email] 
>> </user/SendEmail.jtp?type=node&node=5711880&i=0>> 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 
>>> <http://cakephp.1045679.n5.nabble.com/Copy-branch-of-Tree-to-another-parent-tp5711875.html>
>>> Sent from the CakePHP mailing list archive 
>>> <http://cakephp.1045679.n5.nabble.com/> at Nabble.com 
>>> <http://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 [hidden email] 
>>> </user/SendEmail.jtp?type=node&node=5711880&i=1>.
>>> To unsubscribe from this group, send email to [hidden email] 
>>> </user/SendEmail.jtp?type=node&node=5711880&i=2>.
>>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>>
>>>
>>
>> -- 
>> 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 [hidden email] 
>> </user/SendEmail.jtp?type=node&node=5711880&i=3>.
>> To unsubscribe from this group, send email to [hidden email] 
>> </user/SendEmail.jtp?type=node&node=5711880&i=4>.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the 
>> discussion below:
>> http://cakephp.1045679.n5.nabble.com/Copy-branch-of-Tree-to-another-parent-tp5711875p5711880.html
>>  
>>
>> To start a new topic under CakePHP, email 
>> [email protected]
>> To unsubscribe from CakePHP, click here 
>> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1255722&code=YmlsbC5zdG9sdHpAYm9vc3RlcndlYnNvbHV0aW9ucy5jb218MTI1NTcyMnwtNTU0NTk2MTUy>.
>> NAML 
>> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>  
>>
>





--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Copy-branch-of-Tree-to-another-parent-tp5711875p5711938.html
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to