symfony - Accessing enum values in Twig -
in 1 of entity, added :
class myclass { // annotations /** * @orm\column(type="integer") */ private $status; // status values const created = 10; const refused = 20; const valid = 30; // getters, setters }
so can access these values using myclass::status (myclass::created, myclass::refused etc...) enumeration.
i want check current status of entities in templates. not know how it.
i have tried (hopelessly) :
{% if entity.status == entity.created %}
which not work expected.
but nothing works, , did not find on google or so.
created
not attribute of entity,
try use,
{% if entity.status constant('path_to_your_bundle\\entity\\myclass::created') %}
Comments
Post a Comment