3
I'm與Symfony2的工作,我需要執行這個SQL例如:createQueryBuilder IN子句
select detformacion.* from detformacion left join formacion on detformacion.formacion_id = formacion.id left join detcurso on formacion.id = detcurso.formacion_id where detcurso.id IN ('143','144');
對於這一點,我有這個在我的倉庫:
公衆功能getSeleccion(){
$em = $this->getEntityManager();
$query = $em->createQueryBuilder()
->select('d')
->from('GitekUdaBundle:Detformacion', 'd')
->leftJoin('d.formacion', 'f')
->leftJoin('f.detcursos', 'det')
->where('det.id = :miarray')
->setParameter('miarray',array('143','144'))
->getQuery()
;
return $query->getResult();
}
我嘗試過 - > where('det.id IN:miarray'),但我總是得到錯誤。
任何幫助或線索?
在此先感謝。
更新:問題是設置參數。 IN操作符後