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 ?

3
  • possible duplicate of How to use WHERE IN with Doctrine 2 Commented Apr 2, 2013 at 7: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. Commented Apr 2, 2013 at 7:59
  • hmm yes, apologies for misunderstanding it... +1 for the answer. Commented Apr 2, 2013 at 8:03

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.