title: Object vs array result
body: <p>In my <strong>search filter</strong> <em>(FormBuilder)</em> to return a list of filtering results, I have a form with a relation to an object <em>(multiple checkbox)</em>. It doesn't work.
  I think I have a problem in my <strong>repository</strong> to get an <strong>array vs object result.</strong></p>
  
  <pre><code>&lt;?php
  
  namespace AdminBundle\Controller;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\HttpFoundation\Request;
  
  use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  
  use Symfony\Component\Form\Extension\Core\Type\EmailType;
  use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  use Symfony\Component\Form\Extension\Core\Type\TextType;
  use Symfony\Component\Validator\Constraints as Assert;
  
  use AdminBundle\Entity\Products;
  use AdminBundle\Form\ProductsType;
  
  class ProductsController extends Controller
  {
      /**
       * @Route("/", name="homepage")
       */
      public function indexAction(Request $request)
      {
          $form = $this-&gt;createFormBuilder()
              -&gt;add('category', 'entity', array(
                 'class' =&gt; 'AdminBundle:Category',
                 'label' =&gt; false,
                 'choice_label' =&gt; 'name',
                 'required' =&gt; false,
                 'expanded' =&gt; true,
                 'placeholder' =&gt; 'Tous',
                 'multiple' =&gt; true
             ))
  
             // ...
         ;
  </code></pre>
  
  <p>This is my repository:</p>
  
  <pre><code>&lt;?php
  
  namespace AdminBundle\Repository;
  
  class ProductsRepository extends \Doctrine\ORM\EntityRepository
  {
      public function ListAll($data)
      {
          $query = $this-&gt;createQueryBuilder('a')-&gt;orderBy('a.updated','DESC');
  
          // CATEGORY
          if($data['category'] !== null)
          {
              $query
                  -&gt;innerJoin('a.category', 'cat')
                  -&gt;andWhere('cat.id = :catid')
                  -&gt;setParameter('catid', $data['category'])
              ;
  
              /*
              $query
                  -&gt;leftJoin('a.category', 'category')
                  -&gt;setParameter('category', $data['category'])
              ;
              */
          }
  
          // ...
      }
  }
  </code></pre>
  
  <p>This repository works for just a single select: <code>multiple =&gt; false</code>.  When I set <code>multiple =&gt; true</code>, I get an SQL violation about object vs. array.</p>
  
  <p>How can I deal with the repository for multiple checkboxes?</p>