concrete/src/Attribute/Category/CategoryService.php
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();
    }
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();
    }
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 ( ) ; }
Create a new attribute category.

@param string $akCategoryHandle the category handle
@param int $allowSets One of the StandardSetManager::ASET_ALLOW_... constants
@param Package|null $pkg the package that is creating this category

@return CategoryInterface
Create a new attribute category .