Hi I am so new in symfony2. And I'm having a hard time figuring out what to do with my select box. I need to use an array of "positions" from my database and use it as choices for my select box. Since this project is nearly due, I'd really appreciate any help from you guys.
Atm I have the following codes for my form setup:
$role = $query1->getResult(Query::HYDRATE_ARRAY);
$roles = array();
for($i = 0; $i <count($roles); $i++){
$roles[] = $role[$i]['disrole'];
}
$form = $this->createFormBuilder($position)
->add('position', 'choice', array('choices' => $roles))
->add('save', 'submit', array('label' => 'Search'))->setMethod('POST')
->getForm();
And here's how I use it in my twig template:
<div class="panel-body">
{{ form(form) }}
</div>
I simply output my form like that cause I'm not very familiar with splicing up the form parts. I'd really really appreciate your answers guys! Thank you in advance!