bug #9397 [BUG][Form] Fix nonexistent key id in twig of data collector (francoispluchino)

This PR was merged into the master branch.

Discussion
----------

[BUG][Form] Fix nonexistent key id in twig of data collector

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

When you create a single button form type, the id of data collector does not exist. It's caused by the PR #9394.

Commits
-------

19c74f3 Fix nonexistent key id in twig of data collector
This commit is contained in:
Fabien Potencier 2013-10-29 17:17:02 +01:00
commit d2daf5daac

View File

@ -123,7 +123,9 @@ class FormDataExtractor implements FormDataExtractorInterface
*/
public function extractViewVariables(FormView $view)
{
$data = array();
$data = array(
'id' => $view->vars['id']
);
foreach ($view->vars as $varName => $value) {
$data['view_vars'][$varName] = $this->valueExporter->exportValue($value);