PartKeepr\CategoryBundle\EventListener\RootCategoryListener::checkForRoot PHP Method

checkForRoot() protected method

protected checkForRoot ( AbstractCategory $category )
$category PartKeepr\CategoryBundle\Entity\AbstractCategory
    protected function checkForRoot(AbstractCategory $category)
    {
        if ($category->getParent() === null) {
            try {
                $rootNode = $this->container->get($this->service)->getRootNode();
                if ($rootNode->getId() != $category->getId()) {
                    throw new OnlySingleRootNodeAllowedException();
                }
            } catch (RootNodeNotFoundException $e) {
            }
        }
    }