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:
commit
707e52afd7
@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
|||||||
use Symfony\Component\Validator\ConstraintViolationInterface;
|
use Symfony\Component\Validator\ConstraintViolationInterface;
|
||||||
use Symfony\Component\VarDumper\Caster\Caster;
|
use Symfony\Component\VarDumper\Caster\Caster;
|
||||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||||
|
use Symfony\Component\VarDumper\Caster\StubCaster;
|
||||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
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())),
|
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) {
|
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
|
||||||
return array(
|
return array(
|
||||||
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
|
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
|
||||||
|
@ -15,7 +15,6 @@ use Symfony\Component\Form\FormInterface;
|
|||||||
use Symfony\Component\Form\FormView;
|
use Symfony\Component\Form\FormView;
|
||||||
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
||||||
use Symfony\Component\Validator\ConstraintViolationInterface;
|
use Symfony\Component\Validator\ConstraintViolationInterface;
|
||||||
use Symfony\Component\VarDumper\Caster\CutStub;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of {@link FormDataExtractorInterface}.
|
* Default implementation of {@link FormDataExtractorInterface}.
|
||||||
@ -156,10 +155,6 @@ class FormDataExtractor implements FormDataExtractorInterface
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($view->vars as $varName => $value) {
|
foreach ($view->vars as $varName => $value) {
|
||||||
// Removing redundant variable from view variables
|
|
||||||
if ('form' === $varName) {
|
|
||||||
$value = new CutStub($value);
|
|
||||||
}
|
|
||||||
$data['view_vars'][$varName] = $value;
|
$data['view_vars'][$varName] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user