我尝试在WHERE IN语句中的dbal querybuilder中绑定参数:[1,2]
我试图将$qb->expr()->in()
更改为字符串版本,但没有任何改变
QueryBuilder创建
$qb = $this->_em->getConnection()->createQueryBuilder()
->select('c.id AS id')
->from('category', 'c')
->andWhere($qb->expr()->in('c.id', ':categories'))->setParameter('categories', [1, 2], \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
执行:
$qb->execute()->fetchAll();
错误:Array to string conversion
期望将整数数组绑定到querybuilder语句