So I have this form here in a for. I'd like this checkbox form to repeat himself in every line of my table but it's only repeating the label correctly for each line. I need a way to repeat those Three checks in every line of my table.
Here is the controller (not sure by the way that I created the builder correctly:
<?php
$staffList = $this->getDoctrine()
->getEntityManager()
->getRepository('EnsgtiUserBundle:User')
->findAll();
$formAnnee = $this->createFormBuilder()
->add('checkAnnee1', 'checkbox', array(
'label' => 'test test',
'required' => false,))
->add('checkAnnee2', 'checkbox', array(
'label' => '',
'required' => false,))
->add('checkAnnee3', 'checkbox', array(
'label' => '',
'required' => false,))
->getForm();
//return $this->redirect( $this->generateUrl('EnsgtiEnsgtiBundle_voirList'));
return $this->render('EnsgtiEnsgtiBundle:Appli:voirStaffList.html.twig', array(
'staffList' => $staffList,
'formAnnee' => $formAnnee->createView(),
));
Here is the form:
{% for user in staffList %}
<tr>
<td class="tdVoirStaff"> {{user.nom}} </td>
<td class="tdVoirStaff"> {{user.prenom}} </td>
<td class="tdVoirStaff" nowrap> {{user.email}} </td>
<td class="tdVoirStaff" nowrap>
<form {{ form_enctype(formAnnee) }}>
{{ form_label(formAnnee.checkAnnee1, "1") }}
{{ form_errors(formAnnee.checkAnnee1) }}
{{ form_widget(formAnnee.checkAnnee1) }}
{{ form_label(formAnnee.checkAnnee2, "2") }}
{{ form_errors(formAnnee.checkAnnee2) }}
{{ form_widget(formAnnee.checkAnnee2) }}
{{ form_label(formAnnee.checkAnnee3, "3") }}
{{ form_errors(formAnnee.checkAnnee3) }}
{{ form_widget(formAnnee.checkAnnee3) }}
</form>
</td>
</tr>
{% endfor %}