public function add($akCategoryHandle, $allowSets = StandardSetManager::ASET_ALLOW_SINGLE, $pkg = null) { $category = new Category(); $category->setAttributeKeyCategoryHandle($akCategoryHandle); $category->setAllowAttributeSets($allowSets); if ($pkg) { $category->setPackage($pkg); } $this->entityManager->persist($category); $this->entityManager->flush(); $indexer = $category->getController()->getSearchIndexer(); if (is_object($indexer)) { $indexer->createRepository($category->getController()); } return $category->getController(); }