minor #28037 [Form] fix truncating form views in data collector (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] fix truncating form views in data collector

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no (fixing a non released patch)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Fixes #27923.

Commits
-------

5fa1f12f3c [Form] fix truncating form views in data collector
This commit is contained in:
Nicolas Grekas 2018-07-23 16:49:37 +02:00
commit 707e52afd7
2 changed files with 2 additions and 5 deletions

View File

@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Caster\StubCaster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
@ -262,6 +263,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
);
},
FormView::class => array(StubCaster::class, 'cutInternals'),
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
return array(
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),

View File

@ -15,7 +15,6 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\VarDumper\Caster\CutStub;
/**
* Default implementation of {@link FormDataExtractorInterface}.
@ -156,10 +155,6 @@ class FormDataExtractor implements FormDataExtractorInterface
);
foreach ($view->vars as $varName => $value) {
// Removing redundant variable from view variables
if ('form' === $varName) {
$value = new CutStub($value);
}
$data['view_vars'][$varName] = $value;
}