我有一个状态对象的ArrayCollection,我现在想用作教条查询的WHERE子句中的IN参数.这是我的查询代码:
$query = $repository->createQueryBuilder('r')
->join('r.applicationStatus', 's')
->where('r.submitted IS NOT NULL')
->andWhere('r.created >= :date')
->andWhere('r.created < :date2')
->andWhere('s IN (:status)') // Here's the In statement
->orderBy('r.created', 'DESC')
->setParameter('date', $appSearch->getDateFrom())
->setParameter('date2', $end)
->setParameter('status', $appSearch->getApplicationStatus()) //Here's the array collection
->getQuery();
Run Code Online (Sandbox Code Playgroud)
但是查询返回零记录.为了使它工作,我必须手动迭代$ appSearch-> getApplicationStatus()arraycollection,并在新数组中获取状态id,以便查询产生正确的结果 - 这感觉非常低效.
我究竟做错了什么?