I have checkboxes in my twig file depending on the users I want to delete. Then I have a button that refers to an action of the controller that is supposed to recover through the Request list of checked checkboxes. Only, each time, the list is null.
<th><a href="{{path('user_delete_masse')}}" type="submit" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Supprimer plusieurs utilisateurs </a></th>
//...
{% for ....%}
<td><input type="checkbox" name="usersSuppr[]" value={{unUser.username}} /></td>
{% endfor %}
controler :
/**
* Suppression de plusieurs utilisateurs en même temps
*
* @Route("/delete/masse", name="user_delete_masse")
* @Method("GET")
*/
public function deleteMasseAction(Request $request)
{
dump('delete masse');
$em = $this->getDoctrine()->getManager(); //Récupération du manager
$listeUsernames=$request->get('usersSuppr');
dump($listeUsernames);
//...
}
Is it possible to retrieve the element "usersSuppr []" without having to use a ? Because I already use 2 in my twig file for other features and I can not add this feature with a because it would be a problem, it would mix with others