PHP Interface Sulu\Bundle\CategoryBundle\Category\CategoryManagerInterface

The CategoryManager is responsible for the centralized management of our categories.
Datei anzeigen Open project: sulu/sulu Interface Usage Examples

Public Methods

Method Description
delete ( integer $id ) Deletes the category which is assigned to the given id.
find ( integer $parent = null, integer $depth = null, string | null $sortBy = null, string | null $sortOrder = null ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[] Returns tags with a given parent and/or a given depth-level if no arguments passed returns all categories.
findById ( integer $id ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface Returns the category which is assigned to the given id.
findByIds ( array $ids ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[] Returns an array of categories which are assigned to the given array of ids.
findByKey ( string $key ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface Returns the category which is assigned to the given key.
findChildren ( integer $key, string | null $sortBy = null, string | null $sortOrder = null ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[] Returns the children for a given category.
findChildrenByParentId ( null $parentId = null ) : array Returns the whole category graph.
findChildrenByParentKey ( null $parentKey = null ) : array Returns the whole category graph.
getApiObject ( Sulu\Bundle\CategoryBundle\Entity\CategoryInterface $category, string $locale ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface Returns an API-Object for a given category-entity. The API-Object wraps the entity and provides neat getters and setters.
getApiObjects ( Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[] $categories, string $locale ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface Same as getApiObject, but takes multiple category-entities.
getFieldDescriptor ( string $locale, string $key ) : DoctrineFieldDescriptor Returns the FieldDescriptor for the given key.
getFieldDescriptors ( string $locale ) : DoctrineFieldDescriptor[] Returns the FieldDescriptors for the categories.
save ( $data, $userId, $locale, boolean $patch = false ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface Creates or updates the given data as category in the given locale and return the saved category.

Method Details

delete() public method

Deletes the category which is assigned to the given id.
public delete ( integer $id )
$id integer

find() public method

Returns tags with a given parent and/or a given depth-level if no arguments passed returns all categories.
Deprecation: Use ::findChildrenByParentId instead
public find ( integer $parent = null, integer $depth = null, string | null $sortBy = null, string | null $sortOrder = null ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]
$parent integer the id of the parent to filter for
$depth integer the depth-level to filter for
$sortBy string | null column name to sort the categories by
$sortOrder string | null sort order
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findById() public method

Returns the category which is assigned to the given id.
public findById ( integer $id ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$id integer
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

findByIds() public method

If an id of the array is not assigned to a category, no error is thrown.
public findByIds ( array $ids ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]
$ids array
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findByKey() public method

Returns the category which is assigned to the given key.
public findByKey ( string $key ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$key string
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

findChildren() public method

Returns the children for a given category.
Deprecation: Use ::findChildrenByParentKey instead
public findChildren ( integer $key, string | null $sortBy = null, string | null $sortOrder = null ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]
$key integer the key of the category to search the children for
$sortBy string | null column name to sort by
$sortOrder string | null sort order
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findChildrenByParentId() public method

If parentId is set, only the sub-graph below the category which is assigned to the given id is returned.
public findChildrenByParentId ( null $parentId = null ) : array
$parentId null
return array

findChildrenByParentKey() public method

If parentKey is set, only the sub-graph below the category which is assigned to the given key is returned.
public findChildrenByParentKey ( null $parentKey = null ) : array
$parentKey null
return array

getApiObject() public method

Returns an API-Object for a given category-entity. The API-Object wraps the entity and provides neat getters and setters.
public getApiObject ( Sulu\Bundle\CategoryBundle\Entity\CategoryInterface $category, string $locale ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$category Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$locale string
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getApiObjects() public method

Same as getApiObject, but takes multiple category-entities.
public getApiObjects ( Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[] $categories, string $locale ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$categories Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]
$locale string
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getFieldDescriptor() public method

Returns the FieldDescriptor for the given key.
public getFieldDescriptor ( string $locale, string $key ) : DoctrineFieldDescriptor
$locale string
$key string The key of the FieldDescriptor to return
return Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor

getFieldDescriptors() public method

Returns the FieldDescriptors for the categories.
public getFieldDescriptors ( string $locale ) : DoctrineFieldDescriptor[]
$locale string
return Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor[]

save() public method

If data.id is set, the category which is assigned to the given id is overwritten. If patch is set, the category which is assigned to the given id is updated partially.
public save ( $data, $userId, $locale, boolean $patch = false ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$data
$userId int Id of the user which is set as creator/changer. If null, the user of the request is set
$locale
$patch boolean
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface