/** * Adds a given category. * @param Category $category The category to add to the tree * @return Category the added category */ public function addCategory (Category $category) { $parent = $category->getParent(); if ($parent == 0) { $parent = $this->getRootNode(); } else { $parent = PartKeepr::getEM()->find("de\RaumZeitLabor\PartKeepr\Category\Category", $parent); $parent = new NodeWrapper($parent, $this->getNodeManager()); } return $parent->addChild($category); }