如果我尝试在symfony2中运行此查询
$karte = $em->getRepository('CQIntranetBundle:Karte')->findByPGuId($pguid);
其回报
Entity 'CQ\IntranetBundle\Entity\Karte' has no field 'pGuId'. You can therefore not call 'findByPGuId' on the entities' repository
字段PGuID存在,但查询尝试查找pGuId是否有修复此问题?
答案 0 :(得分:1)
您可以覆盖Karte存储库中的方法:
public function findByPGuId($PGuId) {
return $this->createQueryBuilder('k')
->where('k.PGuId= :PGuId')
->setParameter('PGuId',$PGuId)
->getQuery()
->getResult();
}