Note that there are some explanatory texts on larger screens.

plurals
  1. USMagnanimity
    primarykey
    data
    text
    plurals
    1. COThank you. I realized after trial where and what is happening. I updated by recursive algorithm to the following and it works now: private function getRecursiveChildren($categoryId, $depth, $iteration) { $children = $this->getDoctrine()->getRepository('PmbLicensingBundle:Category')->findByParent($categoryId); if ($depth > $iteration) foreach ($children as $key => $child) { $children[$key] = $child->toArray(); $children[$key]['children'] = $this->getRecursiveChildren($child->getId(), $depth, $iteration+1); } return $children; }
      singulars
    2. COWhen adding `->toArray()` at the end of the method or I attempt `$children = $children->toArray()` the error is: "Call to a member function toArray() on a non-object in ...". $children is not empty. The debug dump of $children returns data (too long to post in comment).
      singulars
    3. COI am trying to build a recursive function where it returns the children categories and the children of the children, etc up to an n depth specified. (3 or 5 levels down for instance). I want to convert the returned categories to an array so that I can append their children to each category with a recursive algorithm. When a category is not supplied to this method at inception, the method assumes that it must start from the top level of categories, which has their parent set to null, so I must use the latter method mentioned.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload