Translating dynamic vars concatening object property in twig template using SonataAdminBundle

0 Flares Twitter 0 Facebook 0 LinkedIn 0 0 Flares ×

My Contract Entity has a history of states and the current state is displayed in the listView. The state is stored as a simple string e.g. “pending” in the database.


But the translation string are stored with a prefix e.g. “contracts.states.pending”:


To make the translation work inside the twig template you can concat the prefix and the property from the database like this:



Web Deviloper