This is my twig form.
<form id="csv" action="{{ path('faturamento_csv') }}" method="post">
{% for elm, value in filtroLocais %}
<input type="hidden" name="{{ elm }}" value="{{ value }}">
{% endfor %}
<button class="btn btn-primary" type="submit">
<i class="icon-bar-chart"></i>
Gerar CSV
</button>
</form>
As a result of the form I have this:
<input type="hidden" value="25" name="0">
<input type="hidden" value="147" name="1">
How do I get these values correctly on the Controller? From what I can identify, the form does not send any value with the name "idLocal"
$form = $this->createForm( new LogPesquisaType() );
$form->bind( $request );
$data = $form->getData();
$filtroLocais = array(); // Inicializa array com locais a pesquisar
foreach ( $data['idLocal'] as $locais ) {
array_push( $filtroLocais, $locais->getIdLocal() );
}
$printers = $this->getDoctrine()->getRepository( 'CacicCommonBundle:LogAcesso')
->faturamentoCsv( $data['dtAcaoInicio'], $data['dtAcaoFim'], $filtroLocais);