Yes, I know this has been asked before and discouraged, but I have a good use case for that. I am interested in learning the view-oriented supplementary approach.
The use case:
I have an entity, say Venue (id, name, capacity)
which I use as collection in EasyAdmin. To render choices, I require this entity to have string representation.
I want the display to say %name% (%capacity% places)
.
As you've correctly guessed, I require the word "places" translated.
I could want to do it
- directly in the entity's
__toString()
method - in form view by properly rendering
__toString()
output
I have no idea how to implement either but I agree that the first approach violates the MVC pattern.
Please advise.