PHP Class Sulu\Bundle\SnippetBundle\Controller\SnippetController

Inheritance: implements Sulu\Component\Security\SecuredControllerInterface, implements FOS\RestBundle\Routing\ClassResourceInterface, use trait Sulu\Component\Rest\RequestParametersTrait
Show file Open project: sulu/sulu

Public Methods

Method Description
__construct ( FOS\RestBundle\View\ViewHandler $viewHandler, ContentMapper $contentMapper, Sulu\Component\Content\Compat\StructureManagerInterface $structureManager, SnippetRepository $snippetRepository, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, Sulu\Bundle\SnippetBundle\Snippet\DefaultSnippetManagerInterface $defaultSnippetManager, Sulu\Component\DocumentManager\DocumentManager $documentManager, FormFactory $formFactory, RequestHashChecker $requestHashChecker, ListRestHelper $listRestHelper )
cgetAction ( Request $request ) : Response Returns list of snippets.
deleteAction ( Request $request, string $uuid ) : Symfony\Component\HttpFoundation\JsonResponse Deletes an existing Snippet.
getAction ( Request $request, string $uuid = null ) : Response Returns snippet by ID.
getFieldsAction ( ) : Symfony\Component\HttpFoundation\JsonResponse TODO refactor.
getLocale ( Request $request )
getSecurityContext ( )
postAction ( Request $request ) : Response Saves a new snippet.
postTriggerAction ( string $uuid, Request $request ) : Response trigger a action for given snippet specified over get-action parameter.
putAction ( Request $request, string $uuid ) : Response Saves a new existing snippet.

Private Methods

Method Description
decorateSnippet ( array $snippet, $locale ) Decorate snippet for HATEOAS.
findDocument ( $uuid, $locale )
getReferentialIntegrityResponse ( string $webspace, PHPCR\NodeInterface[] $references, string $uuid, $locale ) : Response Return a response for the case where there is an referential integrity violation.
getUser ( ) Returns user.
handleView ( $document )
processForm ( Request $request, $document )

Method Details

__construct() public method

public __construct ( FOS\RestBundle\View\ViewHandler $viewHandler, ContentMapper $contentMapper, Sulu\Component\Content\Compat\StructureManagerInterface $structureManager, SnippetRepository $snippetRepository, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, Sulu\Bundle\SnippetBundle\Snippet\DefaultSnippetManagerInterface $defaultSnippetManager, Sulu\Component\DocumentManager\DocumentManager $documentManager, FormFactory $formFactory, RequestHashChecker $requestHashChecker, ListRestHelper $listRestHelper )
$viewHandler FOS\RestBundle\View\ViewHandler
$contentMapper Sulu\Component\Content\Mapper\ContentMapper
$structureManager Sulu\Component\Content\Compat\StructureManagerInterface
$snippetRepository Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository
$tokenStorage Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
$urlGenerator Symfony\Component\Routing\Generator\UrlGeneratorInterface
$defaultSnippetManager Sulu\Bundle\SnippetBundle\Snippet\DefaultSnippetManagerInterface
$documentManager Sulu\Component\DocumentManager\DocumentManager
$formFactory Symfony\Component\Form\FormFactory
$requestHashChecker Sulu\Component\Hash\RequestHashChecker
$listRestHelper Sulu\Component\Rest\ListBuilder\ListRestHelper

cgetAction() public method

Returns list of snippets.
public cgetAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

deleteAction() public method

Deletes an existing Snippet.
public deleteAction ( Request $request, string $uuid ) : Symfony\Component\HttpFoundation\JsonResponse
$request Symfony\Component\HttpFoundation\Request
$uuid string
return Symfony\Component\HttpFoundation\JsonResponse

getAction() public method

Returns snippet by ID.
public getAction ( Request $request, string $uuid = null ) : Response
$request Symfony\Component\HttpFoundation\Request
$uuid string
return Symfony\Component\HttpFoundation\Response

getFieldsAction() public method

TODO refactor.
public getFieldsAction ( ) : Symfony\Component\HttpFoundation\JsonResponse
return Symfony\Component\HttpFoundation\JsonResponse

getLocale() public method

public getLocale ( Request $request )
$request Symfony\Component\HttpFoundation\Request

getSecurityContext() public method

public getSecurityContext ( )

postAction() public method

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

postTriggerAction() public method

trigger a action for given snippet specified over get-action parameter.
public postTriggerAction ( string $uuid, Request $request ) : Response
$uuid string
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

putAction() public method

Saves a new existing snippet.
public putAction ( Request $request, string $uuid ) : Response
$request Symfony\Component\HttpFoundation\Request
$uuid string
return Symfony\Component\HttpFoundation\Response