doctrine2 - get object entity in twig -
this question has answer here:
i have array of objects
$objects = fetch objects db using doctrine in twig want make foreach loop displays entity class names of objects. want because array exists out of different objects.
so try this, ofcourse not work.
{% object in objects %} {{ object.entityclassname }} {% endfor %} how can display entity class name of objects in twig?
i looked question : how can class name of entity object in twig view
is there more simple solution problem? wih
simplest way 1 in link pasted:
public function getclassname() { return (new \reflectionclass($this))->getshortname(); } add method above entity , use in twig:
{{ object.classname }}
Comments
Post a Comment