【发布时间】:2016-10-03 18:53:18
【问题描述】:
我在使用查询生成器删除 id 找到的所有记录时遇到了一些问题 我尝试了下面的代码,但我总是收到这个错误:
[Semantical Error] line 0, col 53 near 'b.id = :surv': Error: 'b' is not defined.
方法:
public function deleteUsers($surveyId) {
$qb = $this->getEntityManager()->createQueryBuilder();
return $qb
->delete()
->from(BaseUser::class, 'a')
->leftJoin('a.survey', 'b')
->where('b.id = :survey')
->setParameter('survey', $surveyId)
->getQuery()
->execute()
;
}
【问题讨论】:
标签: php symfony doctrine-orm