$qb = $this->getDoctrine ()->getEntityManager()->createQueryBuilder();
$qb->delete('MainBundle:StatisticUser', 'u');
$qb->where($qb->expr()->in('sessionid', array_keys($sessionidsToTruncate)));
var_dump($qb->getQuery());
$qb->getQuery()->execute();
private '_dql' => string 'DELETE MainBundle:StatisticUser u WHERE sessionid IN('asdfghjkl')' (length=75)
但我收到错误
[Semantical Error] line 0, col 50 near 'sessionid IN': Error: 'sessionid' is not defined.
有人能指出我的问题吗?
答案 0 :(得分:0)
好的,我找到了试验和错误的解决方案:
$qb->andWhere($qb->expr()->in('u.sessionid', array_keys($sessionidsToTruncate)));