我尝试执行此查询
$em->createQuery('select i from AcmePublicBundle:Public i where i.user in (:opc)');
$query->setParameter('opc', $opc);
where :opc is an array like this
$opc={array}[2]
0 = {array}[1]
id = "9"
1 = {array}[1]
id = "10"
我收到这个错误
Notice: Undefined offset: 0 in...
如果我试试这个
$em->createQuery('select i from AcmePublicBundle:Public i where i.usuario in (9, 10)');
一切安好。但我必须通过$opc
。
有任何想法吗?