简体   繁体   中英

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 ?

尝试将参数$idBase转换为具有ID或字符串的简单数组

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM