PHP Интерфейс Sulu\Bundle\CategoryBundle\Category\CategoryManagerInterface

The CategoryManager is responsible for the centralized management of our categories.
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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.

Описание методов

delete() публичный Метод

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

find() публичный Метод

Returns tags with a given parent and/or a given depth-level if no arguments passed returns all categories.
Устаревший: 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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findById() публичный Метод

Returns the category which is assigned to the given id.
public findById ( integer $id ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$id integer
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

findByIds() публичный Метод

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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findByKey() публичный Метод

Returns the category which is assigned to the given key.
public findByKey ( string $key ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$key string
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

findChildren() публичный Метод

Returns the children for a given category.
Устаревший: 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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface[]

findChildrenByParentId() публичный Метод

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
Результат array

findChildrenByParentKey() публичный Метод

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
Результат array

getApiObject() публичный Метод

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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getApiObjects() публичный Метод

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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface

getFieldDescriptor() публичный Метод

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
Результат Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor

getFieldDescriptors() публичный Метод

Returns the FieldDescriptors for the categories.
public getFieldDescriptors ( string $locale ) : DoctrineFieldDescriptor[]
$locale string
Результат Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor[]

save() публичный Метод

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
Результат Sulu\Bundle\CategoryBundle\Entity\CategoryInterface