Symfony 未定义的方法';rechercheprospect';。方法名称必须以findBy或findOneBy开头
我得到了这个错误:未定义的方法“rechercheprospect”。方法名称必须以findBy或findOneBy开头 这是我的浏览库:Symfony 未定义的方法';rechercheprospect';。方法名称必须以findBy或findOneBy开头,symfony,Symfony,我得到了这个错误:未定义的方法“rechercheprospect”。方法名称必须以findBy或findOneBy开头 这是我的浏览库: <?php namespace Ass\AssurBundle\Entity; use Doctrine\ORM\EntityRepository; /** * ProspectRepository * * This class was generated by the Doctrine ORM. Add your own custom * repo
<?php
namespace Ass\AssurBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* ProspectRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ProspectRepository extends EntityRepository
{
public function rechercheprospect($type){
$qb = $em->createQueryBuilder()
->select('p.nom, p.prenom,COUNT(c.idPros) as nb')
->from('AssAssurBundle:Prospect','p','AssAssurBundle:ComPros','c')
->where(p.type == $type)
->andWhere(p.id == c.idPros)
->andWhere(nb <3);
$pros = $qb->getQuery()->getResult();
return $pros;
}
}
$prosp = $this->getDoctrine()
->getManager()
->getRepository("AssAssurBundle:Prospect")
->rechercheprospect('sante');
有什么帮助吗????
提前感谢这意味着未加载自定义存储库。清除缓存了吗?检查存储库对象-
dump($this->getdoctor()->getManager()->getRepository(“assasssurbundle:Prospect”))下的内容代码>我的版本是symfony 2.3,转储dot-existCheck在Resources/config/doctor下,并删除您可能在那里找到的任何映射文件。它们正在干扰您的批注。没有更改
$prosp = $this->getDoctrine()
->getManager()
->getRepository("AssAssurBundle:Prospect")
->rechercheprospect('sante');