Closed
Description
Symfony version(s) affected
6.0.8, 6.2 (as of 11.07.2022)
Description
Commit d5ce0e3 introduced TranslatableInterface
contract, which could be used for custom translatable objects. As far as I understand this interface should be usable in every place, where TranslatableMessage
could be used. This however is not the case, as it cannot be used for example as result from choice_label
function.
How to reproduce
Create form with ChoiceType
entry, that as choice_label
returns some object implementing TranslatableInterface
.
Possible Solution
In the Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php:178 we have:
} elseif ($dynamicLabel instanceof TranslatableMessage) {
Which should probably be
} elseif ($dynamicLabel instanceof TranslatableInterface) {
The same thing goes for ChoiceView
class.
Additional Context
No response