lundi 3 octobre 2016

Adding multiple children nodes using etrepat/baum library

I am using Baum Library with laravel v5.1 to store company details in a hierarchy manner... Now, while adding new company, there is a situation, where I need to add some same 10 nodes(with all same attributes) as children of some another nodes...

To create a child of any other node, the library provides two methods, but both of them allows the creation of at most one child of any other node at a time, which leads me to iterate those 10 nodes and make them a child of another node one by one... And thus this leads to lots of query execution in the process which takes up time... Suppose, I have some 20 nodes such that each of them has those 10 nodes as children then there will be an execution of 200 queries, which is I guess lots more.

So, is there anyway with which I can insert those 10 nodes as children of another node in a single query?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire