Skip to content

Commit

Permalink
minor #17763 Remove unnecessary retrieval and setting of data (Trent …
Browse files Browse the repository at this point in the history
…Steel)

This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #17763).

Discussion
----------

Remove unnecessary retrieval and setting of data

| Q             | A
| ------------- | ---
| Bug fix?      | No
| New feature?  | No - optimisation
| BC breaks?    | No
| Deprecations? | No
| Tests pass?   | Yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | None

Commits
-------

ea52400 remove unnecessary retrieval and setting of data
  • Loading branch information
Tobion committed Feb 11, 2016
2 parents 730a472 + ea52400 commit d0324e4
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -84,9 +84,10 @@ public function __construct($fieldName, CsrfProviderInterface $csrfProvider, $in
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;

Expand All @@ -99,10 +100,9 @@ public function preSubmit(FormEvent $event)

if (is_array($data)) {
unset($data[$this->fieldName]);
$event->setData($data);
}
}

$event->setData($data);
}

/**
Expand Down

0 comments on commit d0324e4

Please sign in to comment.