/** * Returns all child categories * * @return null|ObjectStorage $posts */ public function getChildCategories() { if (!$this->isFirstLevel()) { return NULL; } if ($this->childCategories === NULL) { $categories = $this->objectManager->get('TYPO3\\T3extblog\\Domain\\Repository\\CategoryRepository')->findByParentId($this->getUid()); $this->childCategories = new ObjectStorage(); foreach ($categories as $category) { $this->childCategories->attach($category); } } return $this->childCategories; }
/** * Removes a Category * * @param \TYPO3\T3extblog\Domain\Model\Category $categoryToRemove The Category to be removed * * @return void */ public function removeCategory(Category $categoryToRemove) { $this->categories->detach($categoryToRemove); }