UserCrudController
extends AbstractCrudController
in package
Provides shortcuts for HTTP-related features in controllers.
Table of Contents
Properties
Methods
- autocomplete() : JsonResponse
- batchDelete() : Response
- configureActions() : Actions
- configureAssets() : Assets
- configureCrud() : Crud
- configureFields() : array<string|int, FieldInterface>|array<string|int, string>
- configureFilters() : Filters
- configureResponseParameters() : KeyValueStore
- Used to add/modify/remove parameters before passing them to the Twig template.
- createEditForm() : FormInterface
- createEditFormBuilder() : FormBuilderInterface
- createEntity() : mixed
- createIndexQueryBuilder() : QueryBuilder
- createNewForm() : FormInterface
- createNewFormBuilder() : FormBuilderInterface
- delete() : KeyValueStore|Response
- deleteEntity() : void
- detail() : KeyValueStore|Response
- edit() : KeyValueStore|Response
- getEntityFqcn() : string
- getSubscribedServices() : array<string|int, string>
- Returns an array of service types required by such instances, optionally keyed by the service names used internally.
- index() : KeyValueStore|Response
- new() : KeyValueStore|Response
- persistEntity() : void
- renderFilters() : KeyValueStore
- setContainer() : ContainerInterface|null
- updateEntity() : void
- addFlash() : void
- Adds a flash message to the current session for type.
- addLink() : void
- Adds a Link HTTP header to the current response.
- ajaxEdit() : AfterCrudActionEvent
- createAccessDeniedException() : AccessDeniedException
- Returns an AccessDeniedException.
- createForm() : FormInterface
- Creates and returns a Form instance from the type of the form.
- createFormBuilder() : FormBuilderInterface
- Creates and returns a form builder instance.
- createNotFoundException() : NotFoundHttpException
- Returns a NotFoundHttpException.
- denyAccessUnlessGranted() : void
- Throws an exception unless the attribute is granted against the current authentication token and optionally supplied subject.
- file() : BinaryFileResponse
- Returns a BinaryFileResponse object with original or customized file name and disposition header.
- forward() : Response
- Forwards the request to another controller.
- generateUrl() : string
- Generates a URL from the given parameters.
- getContext() : AdminContext|null
- getFieldAssets() : AssetsDto
- getParameter() : array<string|int, mixed>|bool|string|int|float|UnitEnum|null
- Gets a container parameter by its name.
- getRedirectResponseAfterSave() : RedirectResponse
- getUser() : UserInterface|null
- Get a user from the Security Token Storage.
- isCsrfTokenValid() : bool
- Checks the validity of a CSRF token.
- isGranted() : bool
- Checks if the attribute is granted against the current authentication token and optionally supplied subject.
- json() : JsonResponse
- Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
- processUploadedFiles() : void
- redirect() : RedirectResponse
- Returns a RedirectResponse to the given URL.
- redirectToRoute() : RedirectResponse
- Returns a RedirectResponse to the given route with the given parameters.
- render() : Response
- Renders a view.
- renderForm() : Response
- Renders a view and sets the appropriate status code when a form is listed in parameters.
- renderView() : string
- Returns a rendered view.
- stream() : StreamedResponse
- Streams a view.
Properties
$container
protected
ContainerInterface
$container
Methods
autocomplete()
public
autocomplete(AdminContext $context) : JsonResponse
Parameters
- $context : AdminContext
Return values
JsonResponsebatchDelete()
public
batchDelete(AdminContext $context, BatchActionDto $batchActionDto) : Response
Parameters
- $context : AdminContext
- $batchActionDto : BatchActionDto
Return values
ResponseconfigureActions()
public
configureActions(Actions $actions) : Actions
Parameters
- $actions : Actions
Return values
ActionsconfigureAssets()
public
configureAssets(Assets $assets) : Assets
Parameters
- $assets : Assets
Return values
AssetsconfigureCrud()
public
configureCrud(Crud $crud) : Crud
Parameters
- $crud : Crud
Return values
CrudconfigureFields()
public
configureFields(string $pageName) : array<string|int, FieldInterface>|array<string|int, string>
Parameters
- $pageName : string
Return values
array<string|int, FieldInterface>|array<string|int, string>configureFilters()
public
configureFilters(Filters $filters) : Filters
Parameters
- $filters : Filters
Return values
FiltersconfigureResponseParameters()
Used to add/modify/remove parameters before passing them to the Twig template.
public
configureResponseParameters(KeyValueStore $responseParameters) : KeyValueStore
Parameters
- $responseParameters : KeyValueStore
Return values
KeyValueStorecreateEditForm()
public
createEditForm(EntityDto $entityDto, KeyValueStore $formOptions, AdminContext $context) : FormInterface
Parameters
- $entityDto : EntityDto
- $formOptions : KeyValueStore
- $context : AdminContext
Return values
FormInterfacecreateEditFormBuilder()
public
createEditFormBuilder(EntityDto $entityDto, KeyValueStore $formOptions, AdminContext $context) : FormBuilderInterface
Parameters
- $entityDto : EntityDto
- $formOptions : KeyValueStore
- $context : AdminContext
Return values
FormBuilderInterfacecreateEntity()
public
createEntity(string $entityFqcn) : mixed
Parameters
- $entityFqcn : string
createIndexQueryBuilder()
public
createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters) : QueryBuilder
Parameters
- $searchDto : SearchDto
- $entityDto : EntityDto
- $fields : FieldCollection
- $filters : FilterCollection
Return values
QueryBuildercreateNewForm()
public
createNewForm(EntityDto $entityDto, KeyValueStore $formOptions, AdminContext $context) : FormInterface
Parameters
- $entityDto : EntityDto
- $formOptions : KeyValueStore
- $context : AdminContext
Return values
FormInterfacecreateNewFormBuilder()
public
createNewFormBuilder(EntityDto $entityDto, KeyValueStore $formOptions, AdminContext $context) : FormBuilderInterface
Parameters
- $entityDto : EntityDto
- $formOptions : KeyValueStore
- $context : AdminContext
Return values
FormBuilderInterfacedelete()
public
delete(AdminContext $context) : KeyValueStore|Response
Parameters
- $context : AdminContext
Return values
KeyValueStore|ResponsedeleteEntity()
public
deleteEntity(EntityManagerInterface $entityManager, mixed $entityInstance) : void
Parameters
- $entityManager : EntityManagerInterface
- $entityInstance : mixed
detail()
public
detail(AdminContext $context) : KeyValueStore|Response
Parameters
- $context : AdminContext
Return values
KeyValueStore|Responseedit()
public
edit(AdminContext $context) : KeyValueStore|Response
Parameters
- $context : AdminContext
Return values
KeyValueStore|ResponsegetEntityFqcn()
public
static getEntityFqcn() : string
Return values
stringgetSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
public
static getSubscribedServices() : array<string|int, string>
For mandatory dependencies:
- ['logger' => 'Psr\Log\LoggerInterface'] means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
- ['loggers' => 'Psr\Log\LoggerInterface[]'] means the objects use the "loggers" name internally to fetch an iterable of Psr\Log\LoggerInterface instances.
- ['Psr\Log\LoggerInterface'] is a shortcut for
- ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface']
otherwise:
- ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency
- ['loggers' => '?Psr\Log\LoggerInterface[]'] denotes an optional iterable dependency
- ['?Psr\Log\LoggerInterface'] is a shortcut for
- ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface']
Return values
array<string|int, string> —The required service types, optionally keyed by service names
index()
public
index(AdminContext $context) : KeyValueStore|Response
Parameters
- $context : AdminContext
Return values
KeyValueStore|Responsenew()
public
new(AdminContext $context) : KeyValueStore|Response
Parameters
- $context : AdminContext
Return values
KeyValueStore|ResponsepersistEntity()
public
persistEntity(EntityManagerInterface $entityManager, mixed $entityInstance) : void
Parameters
- $entityManager : EntityManagerInterface
- $entityInstance : mixed
renderFilters()
public
renderFilters(AdminContext $context) : KeyValueStore
Parameters
- $context : AdminContext
Return values
KeyValueStoresetContainer()
public
setContainer(ContainerInterface $container) : ContainerInterface|null
Parameters
- $container : ContainerInterface
Tags
Return values
ContainerInterface|nullupdateEntity()
public
updateEntity(EntityManagerInterface $entityManager, mixed $entityInstance) : void
Parameters
- $entityManager : EntityManagerInterface
- $entityInstance : mixed
addFlash()
Adds a flash message to the current session for type.
protected
addFlash(string $type, mixed $message) : void
Parameters
- $type : string
- $message : mixed
Tags
addLink()
Adds a Link HTTP header to the current response.
protected
addLink(Request $request, LinkInterface $link) : void
Parameters
- $request : Request
- $link : LinkInterface
Tags
ajaxEdit()
protected
ajaxEdit(EntityDto $entityDto, string|null $propertyName, bool $newValue) : AfterCrudActionEvent
Parameters
- $entityDto : EntityDto
- $propertyName : string|null
- $newValue : bool
Return values
AfterCrudActionEventcreateAccessDeniedException()
Returns an AccessDeniedException.
protected
createAccessDeniedException([string $message = 'Access Denied.' ][, Throwable $previous = null ]) : AccessDeniedException
This will result in a 403 response code. Usage example:
throw $this->createAccessDeniedException('Unable to access this page!');
Parameters
- $message : string = 'Access Denied.'
- $previous : Throwable = null
Tags
Return values
AccessDeniedExceptioncreateForm()
Creates and returns a Form instance from the type of the form.
protected
createForm(string $type[, mixed $data = null ][, array<string|int, mixed> $options = [] ]) : FormInterface
Parameters
- $type : string
- $data : mixed = null
- $options : array<string|int, mixed> = []
Return values
FormInterfacecreateFormBuilder()
Creates and returns a form builder instance.
protected
createFormBuilder([mixed $data = null ][, array<string|int, mixed> $options = [] ]) : FormBuilderInterface
Parameters
- $data : mixed = null
- $options : array<string|int, mixed> = []
Return values
FormBuilderInterfacecreateNotFoundException()
Returns a NotFoundHttpException.
protected
createNotFoundException([string $message = 'Not Found' ][, Throwable $previous = null ]) : NotFoundHttpException
This will result in a 404 response code. Usage example:
throw $this->createNotFoundException('Page not found!');
Parameters
- $message : string = 'Not Found'
- $previous : Throwable = null
Return values
NotFoundHttpExceptiondenyAccessUnlessGranted()
Throws an exception unless the attribute is granted against the current authentication token and optionally supplied subject.
protected
denyAccessUnlessGranted(mixed $attribute[, mixed $subject = null ][, string $message = 'Access Denied.' ]) : void
Parameters
- $attribute : mixed
- $subject : mixed = null
- $message : string = 'Access Denied.'
Tags
file()
Returns a BinaryFileResponse object with original or customized file name and disposition header.
protected
file(SplFileInfo|string $file[, string $fileName = null ][, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT ]) : BinaryFileResponse
Parameters
- $file : SplFileInfo|string
- $fileName : string = null
- $disposition : string = ResponseHeaderBag::DISPOSITION_ATTACHMENT
Return values
BinaryFileResponseforward()
Forwards the request to another controller.
protected
forward(string $controller[, array<string|int, mixed> $path = [] ][, array<string|int, mixed> $query = [] ]) : Response
Parameters
- $controller : string
-
The controller name (a string like Bundle\BlogBundle\Controller\PostController::indexAction)
- $path : array<string|int, mixed> = []
- $query : array<string|int, mixed> = []
Return values
ResponsegenerateUrl()
Generates a URL from the given parameters.
protected
generateUrl(string $route[, array<string|int, mixed> $parameters = [] ][, int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH ]) : string
Parameters
- $route : string
- $parameters : array<string|int, mixed> = []
- $referenceType : int = UrlGeneratorInterface::ABSOLUTE_PATH
Tags
Return values
stringgetContext()
protected
getContext() : AdminContext|null
Return values
AdminContext|nullgetFieldAssets()
protected
getFieldAssets(FieldCollection $fieldDtos) : AssetsDto
Parameters
- $fieldDtos : FieldCollection
Return values
AssetsDtogetParameter()
Gets a container parameter by its name.
protected
getParameter(string $name) : array<string|int, mixed>|bool|string|int|float|UnitEnum|null
Parameters
- $name : string
Return values
array<string|int, mixed>|bool|string|int|float|UnitEnum|nullgetRedirectResponseAfterSave()
protected
getRedirectResponseAfterSave(AdminContext $context, string $action) : RedirectResponse
Parameters
- $context : AdminContext
- $action : string
Return values
RedirectResponsegetUser()
Get a user from the Security Token Storage.
protected
getUser() : UserInterface|null
Tags
Return values
UserInterface|nullisCsrfTokenValid()
Checks the validity of a CSRF token.
protected
isCsrfTokenValid(string $id, string|null $token) : bool
Parameters
- $id : string
-
The id used when generating the token
- $token : string|null
-
The actual token sent with the request that should be validated
Return values
boolisGranted()
Checks if the attribute is granted against the current authentication token and optionally supplied subject.
protected
isGranted(mixed $attribute[, mixed $subject = null ]) : bool
Parameters
- $attribute : mixed
- $subject : mixed = null
Tags
Return values
booljson()
Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
protected
json(mixed $data[, int $status = 200 ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $context = [] ]) : JsonResponse
Parameters
- $data : mixed
- $status : int = 200
- $headers : array<string|int, mixed> = []
- $context : array<string|int, mixed> = []
Return values
JsonResponseprocessUploadedFiles()
protected
processUploadedFiles(FormInterface $form) : void
Parameters
- $form : FormInterface
redirect()
Returns a RedirectResponse to the given URL.
protected
redirect(string $url[, int $status = 302 ]) : RedirectResponse
Parameters
- $url : string
- $status : int = 302
Return values
RedirectResponseredirectToRoute()
Returns a RedirectResponse to the given route with the given parameters.
protected
redirectToRoute(string $route[, array<string|int, mixed> $parameters = [] ][, int $status = 302 ]) : RedirectResponse
Parameters
- $route : string
- $parameters : array<string|int, mixed> = []
- $status : int = 302
Return values
RedirectResponserender()
Renders a view.
protected
render(string $view[, array<string|int, mixed> $parameters = [] ][, Response $response = null ]) : Response
Parameters
- $view : string
- $parameters : array<string|int, mixed> = []
- $response : Response = null
Return values
ResponserenderForm()
Renders a view and sets the appropriate status code when a form is listed in parameters.
protected
renderForm(string $view[, array<string|int, mixed> $parameters = [] ][, Response $response = null ]) : Response
If an invalid form is found in the list of parameters, a 422 status code is returned.
Parameters
- $view : string
- $parameters : array<string|int, mixed> = []
- $response : Response = null
Return values
ResponserenderView()
Returns a rendered view.
protected
renderView(string $view[, array<string|int, mixed> $parameters = [] ]) : string
Parameters
- $view : string
- $parameters : array<string|int, mixed> = []
Return values
stringstream()
Streams a view.
protected
stream(string $view[, array<string|int, mixed> $parameters = [] ][, StreamedResponse $response = null ]) : StreamedResponse
Parameters
- $view : string
- $parameters : array<string|int, mixed> = []
- $response : StreamedResponse = null