[Form] fix truncating form views in data collector

This commit is contained in:
Nicolas Grekas 2018-07-23 14:58:27 +02:00
parent d61bedabd5
commit 5fa1f12f3c
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;
}