使用此 DQL 时
$getImages = $em->createQuery('SELECT stuff
FROM MyBundle:MyModelClass
WHERE model.id NOT IN (:hide)')
->setParameter('hide', join(',', $hide), 'array');
生成的 SQL 将映射到:
SELECT stuff FROM mymodelclass WHERE model.id NOT IN ('1,2,3');
这显然是错误的
SELECT stuff FROM mymodelclass WHERE model.id NOT IN (1,2,3);
所以查询是正确的。如何告诉教义映射数组而不将其转义为字符串?