database - How to display multiple data sets in Symfony2 -
i totally new symfony , d know how manage display multiple info sets db in twig... untill effort following:
class projcontroller extends controller { /** * @route("/", name="_projekte") * @template("fhbingenbundle:projekte:list.html.twig") * */ public function indexaction() { $projekte = $this->getdoctrine() ->getrepository('fhbingenbundle:projekt')->findall(); homecoming $projekte; } }
to info sets. here problem starts... how extract info array? (the entity has multiple columns want 2 of them, name , description)
{% extends "fhbingenbundle::layout.html.twig" %} {% block content %} <table> <?php foreach ($liste $projekt ?> <tr><p>{{ $projekt->getname() }}</p></tr> <?php endforeach;?> </table> {% endblock %}
thats how tried apperently not allowed utilize $ within of {{}}? atleast thats error says
you should consider reading cookbook.
since using twig, think using twig templating system.
{% item in navigation %} // equivalent foreach($navigation $item) { {{ item.name }} // equivalent $item->name or $item->getname() or $item->hasname() {% endfor %} // equivalent }
edit : don't remember seems have homecoming array twig templating system. return array('projects' => $projects);
database symfony2 twig
No comments:
Post a Comment