原则删除与查询生成器一个IN


    $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. 

谁能指出我的问题?

好的,

我找到了反复试验的解决方案:

$qb->andWhere($qb->expr()->in('u.sessionid', array_keys($sessionidsToTruncate)));

相关内容

  • 没有找到相关文章

最新更新