PHP Interface Sulu\Bundle\CategoryBundle\Category\CategoryManagerInterface

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

Méthodes publiques

Méthode 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 méthode

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

find() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findById() public méthode

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

findByIds() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findByKey() public méthode

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

findChildren() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findChildrenByParentId() public méthode

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
Résultat array

findChildrenByParentKey() public méthode

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
Résultat array

getApiObject() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getApiObjects() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getFieldDescriptor() public méthode

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
Résultat Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor

getFieldDescriptors() public méthode

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

save() public méthode

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
Résultat Sulu\Bundle\CategoryBundle\Entity\CategoryInterface