You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I've created an translator decorator, the decorator needs interface TranslatorInterface.
The Symfony\Component\Translation\TranslatorInterface is deprecated but when you want to use the new interface you get an error in prod mode with the deprecated TranslatorInterface this only happens in prod mode in dev mode i don't see an error.
An quick search in the symfony project shows that 'use Symfony\Component\Translation\TranslatorInterface' is still used in 24 places
Dev mode ./bin/console c:c
// Clearing the cache for the dev environment with debug true
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
Prod mode
./bin/console --env=prod
// Clearing the cache for the prod environment with debug false
In ValidatorBuilder.php line 259:
Argument 1 passed to Symfony\Component\Validator\ValidatorBuilder::setTranslator() must implement interface Symfony\Component\Translation\TranslatorInterface, instance of App\Service\Translator\TranslatorDecorator given, called in var/cache/pro_/ContainerYjknBhx/getValidator_BuilderService.php on line 32
How to reproduce
In config/services.yaml add the following line:
app.decorating_translator:
class: App\Service\Translator\TranslatorDecoratordecorates: translatorarguments: ['@app.decorating_translator.inner'] # original translatorpublic: false
…or 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
-------
a12656e [FrameworkBundle] decorate the ValidatorBuilder's translator with LegacyTranslatorProxy
Symfony version(s) affected: 4.2.5
Description
I've created an translator decorator, the decorator needs interface TranslatorInterface.
The Symfony\Component\Translation\TranslatorInterface is deprecated but when you want to use the new interface you get an error in prod mode with the deprecated TranslatorInterface this only happens in prod mode in dev mode i don't see an error.
An quick search in the symfony project shows that 'use Symfony\Component\Translation\TranslatorInterface' is still used in 24 places
Dev mode
./bin/console c:c
Prod mode
./bin/console --env=prod
How to reproduce
In config/services.yaml add the following line:
Add file src/Service/Translator/TranslatorDecorator.php
The do an symfony cache clear
./bin/console cache:clear --env=prod
on prod and the error will appear.The text was updated successfully, but these errors were encountered: