Caryl Chessman
Caryl Chessman

Reputation: 3

Query builder symfony2 using where IN

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 ?

Upvotes: 0

Views: 900

Answers (1)

Erioch
Erioch

Reputation: 359

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

Upvotes: 3

Related Questions