-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Hi,
Since PHP 8.1 we can use Enums. Which in my opinion are a great asset to PHP.
But unfortunate there is not an elegant way of retrieving values inside Twig templates.
I currently use this in my Symfony project;
{{ constant('App\\...\\Enum::Key').value }}
Which will return the value of the key in de the Enum.
Maybe it's good to add some specific functions for this in the Twig core?
Regards, Bert
vkondratjevs, Miras4207, allejo, RSickenberg, Erdou and 41 more
Metadata
Metadata
Assignees
Labels
No labels