In Twig:
{% for l in locations %}
<tr>
<td>
<input type="checkbox" class="filled-in" id="filled-in-box-{{ l.idLocation }}" />
<label for="filled-in-box-{{ l.idLocation }}"></label>
</td>
<td>{{ l.loc }}</td>
<td>{{ l.mun }}</td>
<td>{{ l.pro }}</td>
<td>{{ l.cou }}</td>
{#<td>
{% if l.active == 1 %}
<span class="fa fa-check"></span>
{% else %}
<span class="fa fa-close"></span>
{% endif %}
</td>#}
<td><a href="{{ url('admin_edit_location',{'id': l.idLocation}) }}" class="db-list-edit"><span class="fa fa-pencil-square-o"></span></a>
</td>
</tr>{% endfor %}
The route admin_edit_location
:
admin_edit_location:
path: /edit_location/{id}
defaults: { _controller: "AppBundle:Admin:editLocation" }
methods: GET
And the controller
public function editLocationAction($id){
// use $id
$em = $this->getDoctrine()->getManager();
$location = $em->getRepository('BackendBundle:locations')->findOneBy(array(
'id' => $id
));
}