class CsrfValidationListener implements EventSubscriberInterface

Methods

static array
getSubscribedEvents()

Returns an array of event names this subscriber wants to listen to.

__construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, TranslatorInterface $translator = null, string|null $translationDomain = null, ServerParams $serverParams = null)

No description

preSubmit(FormEvent $event)

No description

preBind(FormEvent $event) deprecated

Alias of {@link preSubmit()}.

Details

at line 39
static array getSubscribedEvents()

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2')))

Return Value

array The event names to listen to

at line 57
__construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, TranslatorInterface $translator = null, string|null $translationDomain = null, ServerParams $serverParams = null)

Parameters

string $fieldName The name of the CSRF field
CsrfTokenManagerInterface $tokenManager The generator for CSRF tokens
string $tokenId A text mentioning the tokenId of the CSRF token Validation of the token will only succeed if it was generated in the same session and with the same tokenId
string $errorMessage The message displayed in case of an error
TranslatorInterface $translator
string|null $translationDomain
ServerParams $serverParams

at line 74
preSubmit(FormEvent $event)

Parameters

FormEvent $event

at line 105
preBind(FormEvent $event) deprecated

deprecated since version 2.3, to be removed in 3.0. Use {@link preSubmit()} instead.

Alias of {@link preSubmit()}.

Parameters

FormEvent $event