Skip to content

Commit ef70509

Browse files
bug #31108 [FrameworkBundle] decorate the ValidatorBuilder's translator with LegacyTranslatorProxy (nicolas-grekas)
This PR was merged into the 4.2 branch. Discussion ---------- [FrameworkBundle] decorate the ValidatorBuilder's translator with LegacyTranslatorProxy | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31092, #31025 | License | MIT | Doc PR | - This allows defining a translator that implements only the new interface and use it with ValidatorBuilder. ping @dvdknaap, @snebes since you were affected. Commits ------- a12656eaad [FrameworkBundle] decorate the ValidatorBuilder's translator with LegacyTranslatorProxy
2 parents 25aca64 + ed9debd commit ef70509

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ValidatorBuilder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterfac
258258
*/
259259
public function setTranslator(LegacyTranslatorInterface $translator)
260260
{
261-
$this->translator = $translator instanceof LegacyTranslatorProxy ? $translator->getTranslator() : $translator;
261+
$this->translator = $translator;
262+
263+
while ($this->translator instanceof LegacyTranslatorProxy) {
264+
$this->translator = $this->translator->getTranslator();
265+
}
262266

263267
return $this;
264268
}

0 commit comments

Comments
 (0)