PHP Class Sulu\Bundle\CategoryBundle\Controller\CategoryController

Inheritance: extends Sulu\Component\Rest\RestController, implements FOS\RestBundle\Routing\ClassResourceInterface, implements Sulu\Component\Security\SecuredControllerInterface, use trait Sulu\Component\Rest\RequestParametersTrait
Datei anzeigen Open project: sulu/sulu

Protected Properties

Property Type Description
$entityKey
$entityName

Public Methods

Method Description
cgetAction ( Request $request ) : Response Returns the whole category graph.
deleteAction ( $id ) : Response Deletes the category which is assigned to the given id.
getAction ( $id, Request $request ) : Response Returns the category which is assigned to the given id.
getChildrenAction ( mixed $parentId, Request $request ) : Response Returns the sub-graph below the category which is assigned to the given parentId.
getFieldsAction ( Request $request ) : mixed Returns all fields that can be used by list.
getSecurityContext ( )
patchAction ( Request $request, $id ) : Response Partly updates the category which is assigned to the given id.
postAction ( Request $request ) : Response Adds a new category.
putAction ( $id, Request $request ) : Response Updates the category which is assigned to the given id.

Protected Methods

Method Description
getListRepresentation ( Request $request, $locale, null $parentId = null, array $expandIds = [] ) : CategoryListRepresentation Returns a category-list-representation for the category graph respective to the request.
saveCategory ( Request $request, null $id = null, boolean $patch = false ) : Response Creates or updates a category based on the request.

Private Methods

Method Description
getCategoryManager ( ) : Sulu\Bundle\CategoryBundle\Category\CategoryManagerInterface Returns the CategoryManager.
initializeListBuilder ( $locale ) : DoctrineListBuilder Initializes and returns a ListBuilder instance which is used when returning a CategoryListRepresentation for the given locale. The returned ListBuilder is initialized with the request-parameters and respective select fields.

Method Details

cgetAction() public method

If request.rootKey is set, only the sub-graph below the category which is assigned to the given key is returned. If request.flat is set, only the first level of the respective graph is returned in a flat format. If request.expand is set, the paths to the respective categories are expanded.
public cgetAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

deleteAction() public method

Deletes the category which is assigned to the given id.
public deleteAction ( $id ) : Response
$id
return Symfony\Component\HttpFoundation\Response

getAction() public method

Returns the category which is assigned to the given id.
public getAction ( $id, Request $request ) : Response
$id
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

getChildrenAction() public method

This method is used by the husky datagrid to load children of a category. If request.flat is set, only the first level of the respective graph is returned in a flat format.
public getChildrenAction ( mixed $parentId, Request $request ) : Response
$parentId mixed
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

getFieldsAction() public method

Returns all fields that can be used by list.
public getFieldsAction ( Request $request ) : mixed
$request Symfony\Component\HttpFoundation\Request
return mixed

getListRepresentation() protected method

The category-list-representation contains only the root level of the category graph. If parentId is set, the root level of the sub-graph below the category with the given parentId is returned. If expandIds is set, the paths to the categories which are assigned to the ids are expanded.
protected getListRepresentation ( Request $request, $locale, null $parentId = null, array $expandIds = [] ) : CategoryListRepresentation
$request Symfony\Component\HttpFoundation\Request
$locale
$parentId null
$expandIds array
return Sulu\Bundle\CategoryBundle\Category\CategoryListRepresentation

getSecurityContext() public method

public getSecurityContext ( )

patchAction() public method

Properties which are not set in the request will not be changed.
public patchAction ( Request $request, $id ) : Response
$request Symfony\Component\HttpFoundation\Request
$id
return Symfony\Component\HttpFoundation\Response

postAction() public method

Adds a new category.
public postAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

putAction() public method

Properties which are not set in the request will be removed from the category.
public putAction ( $id, Request $request ) : Response
$id
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

saveCategory() protected method

If 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.
protected saveCategory ( Request $request, null $id = null, boolean $patch = false ) : Response
$request Symfony\Component\HttpFoundation\Request
$id null
$patch boolean
return Symfony\Component\HttpFoundation\Response

Property Details

$entityKey protected_oe static_oe property

protected static $entityKey

$entityName protected_oe static_oe property

protected static $entityName