remove unnecessary retrieval and setting of data
This commit is contained in:
parent
730a472721
commit
ea52400097
@ -84,9 +84,10 @@ class CsrfValidationListener implements EventSubscriberInterface
|
||||
public function preSubmit(FormEvent $event)
|
||||
{
|
||||
$form = $event->getForm();
|
||||
$data = $event->getData();
|
||||
|
||||
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
|
||||
$data = $event->getData();
|
||||
|
||||
if (!isset($data[$this->fieldName]) || !$this->csrfProvider->isCsrfTokenValid($this->intention, $data[$this->fieldName])) {
|
||||
$errorMessage = $this->errorMessage;
|
||||
|
||||
@ -99,11 +100,10 @@ class CsrfValidationListener implements EventSubscriberInterface
|
||||
|
||||
if (is_array($data)) {
|
||||
unset($data[$this->fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
$event->setData($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of {@link preSubmit()}.
|
||||
|
Reference in New Issue
Block a user