getChildren() public method

Returns the children.
public getChildren ( ) : ArrayCollection
return Doctrine\Common\Collections\ArrayCollection
Exemplo n.º 1
0
 /**
  * Creates a node structure for the given path.
  *
  * @param $path       array The components of the path
  * @param $parentNode FootprintCategory  The parent node
  *
  * @return FootprintCategory
  */
 protected function addFootprintCategoryPath(array $path, FootprintCategory $parentNode)
 {
     if (count($path) == 0) {
         return $parentNode;
     }
     $name = array_shift($path);
     $category = null;
     foreach ($parentNode->getChildren() as $child) {
         if ($child->getName() == $name) {
             $category = $child;
         }
     }
     if ($category === null) {
         $category = new FootprintCategory();
         $category->setParent($parentNode);
         $category->setName($name);
         $parentNode->getChildren()->add($category);
         $this->entityManager->persist($category);
     }
     return $this->addFootprintCategoryPath($path, $category);
 }