Okay, basically, I have formed a mySQL query which returns a data set all sorted perfectly of my data structure. If I was to declare it, it would look something like this:
$arr = array(
array( 'name' => 'Root', 'depth' => 0 ),
array( 'name' => 'Food', 'depth' => 0 ),
array( 'name' => 'Fruit', 'depth' => 1 ),
array( 'name' => 'Bannnanna', 'depth' => 2 ),
array( 'name' => 'Apple', 'depth' => 2 ),
array( 'name' => 'Bannnanna', 'depth' => 2 ),
array( 'name' => 'Meat', 'depth' => 1 ),
array( 'name' => 'Furniture', 'depth' => 0 )
);
What I want, is to feed this $arr into a method so that I can then get a multi-dimensional array back.
For instance, Fruit would be a child of Food. And Bananana would be a child of Fruit. I need the keys of each 'child' to be 'pages'.
The array that I showed above can also return other information such as 'lft' and 'rgt'. I do not have 'parentId' set but I can change my model if its required, but I would prefer to stick with Nested Set Model.