0

I have the following query builder to add to my entity.

'query_builder' => function(\Teln\OperatorBundle\Entity\SoftswitchRepository $er) use ($idBase) {
    $qb = $er->createQueryBuilder('t')
    ->where('t.base IN (:id)')
    ->setParameter('id', $idBase);

    return $qb;
},

and $idBase= $builder->getData()->getBases();

So $idBase is a collection.

How to add this to the where using IN ?

j0k
  • 22,600
  • 28
  • 79
  • 90
  • possible duplicate of [How to use WHERE IN with Doctrine 2](http://stackoverflow.com/questions/5929036/how-to-use-where-in-with-doctrine-2) – Venu Apr 02 '13 at 07:45
  • @venu this is not really a duplicate since the syntax is correct (and was the same from 2nd answer from your dup). Caryl just need to convert the collection to an array of ids. – j0k Apr 02 '13 at 07:59
  • hmm yes, apologies for misunderstanding it... +1 for the answer. – Venu Apr 02 '13 at 08:03

1 Answers1

3

Try to convert the parameter $idBase to a simple array with the id's or a string

Erioch
  • 359
  • 4
  • 13