Php 绕过symfony2中的findBy,强制将小写字母作为第一个字母
如果我尝试在symfony2中运行此查询Php 绕过symfony2中的findBy,强制将小写字母作为第一个字母,php,mysql,symfony,Php,Mysql,Symfony,如果我尝试在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存在
$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是否对此进行了修复?您可以覆盖Karte存储库中的方法:
public function findByPGuId($PGuId) {
return $this->createQueryBuilder('k')
->where('k.PGuId= :PGuId')
->setParameter('PGuId',$PGuId)
->getQuery()
->getResult();
}
您是否尝试通过([“PGuId”=>$PGuId])查找
?实体中字段的映射中有哪些内容?