I trying to display price, but occurs error Impossible to access an attribute ("small_pizza") on a string variable ("Margherita").
This is my Controller:
/**
* @Route(
* "/menu",
* name = "pizza_menu"
* )
*
* @Template
*/
public function menuAction() {
$Repo = $this->getDoctrine()->getRepository('PizzaBundle:Menu');
$rows = $Repo->findAll();
return array(
'rows' => $rows
);
}
And this is my database: enter image description here
In a Twig code is this:
{% for entry in rows %}
<tr>
<td>{{ entry.id }}</td>
<td>{{ entry.name }}</td>
<td>{{ entry.components }}</td>
<td>
<ul>
<li>{{ entry.name.small_pizza }}</li>
<li>{{ entry.name.small_pizza }}</li>
<li>{{ entry.name.small_pizza }}</li>
<li>{{ entry.name.small_pizza }}</li>
</ul>
</td>
</tr>
Help me please :)