title: put data form database into checkbox symfony 3
body: <p>I started learn symfony 3. For the first project i chose a simple totodlist.</p>
  
  <p>So now i have possibility to create and save the user in my database. Next I can create a task for them. </p>
  
  <p>I want to create a checkbox where can i choose a users to perform a task.</p>
  
  <p>So i need put data from my user database to checkbox form ($temp_users varbiable). I don't know how to do it.</p>
  
  <p>Can anybody show me how to do it.</p>
  
  <p>below is my code:</p>
  
  <pre><code>public function createAction(Request $request)
  {
  
      $todo = new Todo;
  
      $users = $this-&gt;getDoctrine()
      -&gt;getRepository('AppBundle:User')
      -&gt;findAll();
  
      $temp_users = array();
      foreach($users as $user) {
      $temp_users[$user-&gt;getUsername()] = $user-&gt;getId();
  </code></pre>
  
  <p>}</p>
  
  <pre><code> $form = $this-&gt;createFormBuilder($todo)
       -&gt;add('name', TextType::class, array('attr' =&gt; array('class' =&gt; 'form-     control', 'style' =&gt; 'margin-bottom:15px')))
  
  
      -&gt;add('wykona', CheckboxType::class, array('label' =&gt; $temp_users, 'required' =&gt; false,))
  </code></pre>