【发布时间】:2018-05-16 15:15:46
【问题描述】:
在我的数据库中进行更改后,我将删除另一个表中的一些相关条目。
我在我的存储库中进行了自定义查询:
public function removeOptionGc(VarianteEscalier $varianteEscalier) {
$em=$this->getEntityManager();
return $em->createQueryBuilder()
->delete(VarianteEscalierOptGc::class, "vogc")
->join("vogc.gardecorpsOption", "gco")
->where("vogc.varianteEscalier=:VARIANTE")
->andWhere("gco.type='option_gc_rampant' OR gco.type='option_gc_etage' OR gco.type='autres'")
->setParameters(array('VARIANTE'=>$varianteEscalier))
->getQuery()
->getResult();
}
当我执行它时,我会得到以下错误:
[语义错误] 第 0 行,第 94 列靠近 'gco.type='option_gc_rampant'':错误:'gco' 未定义。
这是我从这个查询中得到的 DQL:
DELETE AppBundle\Entity\VarianteEscalierOptGc vogc WHERE vogc.varianteEscalier=:VARIANTE AND (gco.type='option_gc_rampant' OR gco.type='option_gc_etage' OR gco.type='autres')
知道为什么在我尝试delete 时会忽略join 吗?
【问题讨论】:
标签: symfony dql symfony-3.4