| Methods |
public
|
setContainer(ContainerInterface $container): ?ContainerInterface
|
#
|
protected
|
getParameter(string $name): array|bool|string|int|float|UnitEnum|null
Gets a container parameter by its name.
Gets a container parameter by its name.
|
#
|
public
static
|
getSubscribedServices(): array
Returns an array of service types (or {@see SubscribedService} objects) required
by such instances, optionally keyed by…
Returns an array of service types (or {@see SubscribedService} objects) required
by such instances, optionally keyed by the service names used internally.
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']
additionally, an array of {@see SubscribedService}'s can be returned:
- [new SubscribedService('logger', Psr\Log\LoggerInterface::class)]
- [new SubscribedService(type: Psr\Log\LoggerInterface::class, nullable: true)]
- [new SubscribedService('http_client', HttpClientInterface::class, attributes: new Target('githubApi'))]
Returns
The required service types, optionally keyed by service names
Implements
|
#
|
protected
|
generateUrl(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
Generates a URL from the given parameters.
Generates a URL from the given parameters.
|
#
|
protected
|
forward(string $controller, array $path = [], array $query = []): Response
Forwards the request to another controller.
Forwards the request to another controller.
Parameters
| $controller |
The controller name (a string like Bundle\BlogBundle\Controller\PostController::indexAction)
|
|
#
|
protected
|
redirect(string $url, int $status = 302): RedirectResponse
Returns a RedirectResponse to the given URL.
Returns a RedirectResponse to the given URL.
Parameters
| $status |
The HTTP status code (302 "Found" by default)
|
|
#
|
protected
|
redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse
Returns a RedirectResponse to the given route with the given parameters.
Returns a RedirectResponse to the given route with the given parameters.
Parameters
| $status |
The HTTP status code (302 "Found" by default)
|
|
#
|
protected
|
json(mixed $data, int $status = 200, array $headers = [], array $context = []): JsonResponse
Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
Parameters
| $status |
The HTTP status code (200 "OK" by default)
|
|
#
|
protected
|
file(
SplFileInfo|string $file,
string $fileName = null,
string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT,
): BinaryFileResponse
Returns a BinaryFileResponse object with original or customized file name and disposition header.
Returns a BinaryFileResponse object with original or customized file name and disposition header.
|
#
|
protected
|
addFlash(string $type, mixed $message): void
Adds a flash message to the current session for type.
Adds a flash message to the current session for type.
Throws
|
#
|
protected
|
isGranted(mixed $attribute, mixed $subject = null): bool
Checks if the attribute is granted against the current authentication token and optionally supplied subject.
Checks if the attribute is granted against the current authentication token and optionally supplied subject.
Throws
|
#
|
protected
|
denyAccessUnlessGranted(mixed $attribute, mixed $subject = null, string $message = 'Access Denied.'): void
Throws an exception unless the attribute is granted against the current authentication token and optionally
supplied…
Throws an exception unless the attribute is granted against the current authentication token and optionally
supplied subject.
Throws
Symfony\Component\Security\Core\Exception\AccessDeniedException |
|
|
#
|
protected
|
renderView(string $view, array $parameters = []): string
Returns a rendered view.
Returns a rendered view.
Forms found in parameters are auto-cast to form views.
|
#
|
protected
|
render(string $view, array $parameters = [], Response $response = null): Response
Renders a view.
Renders a view.
If an invalid form is found in the list of parameters, a 422 status code is returned.
Forms found in parameters are auto-cast to form views.
|
#
|
protected
|
renderForm(string $view, array $parameters = [], Response $response = null): Response
Renders a view and sets the appropriate status code when a form is listed in parameters.
Renders a view and sets the appropriate status code when a form is listed in parameters.
If an invalid form is found in the list of parameters, a 422 status code is returned.
Deprecated
since Symfony 6.2, use render() instead
|
#
|
protected
|
stream(string $view, array $parameters = [], StreamedResponse $response = null): StreamedResponse
Streams a view.
|
#
|
protected
|
createNotFoundException(string $message = 'Not Found', Throwable $previous = null): NotFoundHttpException
Returns a NotFoundHttpException.
Returns a NotFoundHttpException.
This will result in a 404 response code. Usage example:
throw $this->createNotFoundException('Page not found!');
|
#
|
protected
|
createAccessDeniedException(string $message = 'Access Denied.', Throwable $previous = null): AccessDeniedException
Returns an AccessDeniedException.
Returns an AccessDeniedException.
This will result in a 403 response code. Usage example:
throw $this->createAccessDeniedException('Unable to access this page!');
Throws
|
#
|
protected
|
createForm(string $type, mixed $data = null, array $options = []): FormInterface
Creates and returns a Form instance from the type of the form.
Creates and returns a Form instance from the type of the form.
|
#
|
protected
|
createFormBuilder(mixed $data = null, array $options = []): FormBuilderInterface
Creates and returns a form builder instance.
Creates and returns a form builder instance.
|
#
|
protected
|
getUser(): ?UserInterface
Get a user from the Security Token Storage.
Get a user from the Security Token Storage.
Throws
|
#
|
protected
|
isCsrfTokenValid(string $id, string|null $token): bool
Checks the validity of a CSRF token.
Checks the validity of a CSRF token.
Parameters
| $id |
The id used when generating the token
|
| $token |
The actual token sent with the request that should be validated
|
|
#
|
protected
|
addLink(Request $request, LinkInterface $link): void
Adds a Link HTTP header to the current response.
Adds a Link HTTP header to the current response.
|
#
|
protected
|
sendEarlyHints(LinkInterface[] $links = [], Response $response = null): Response
|
#
|