未定义的方法'rechercheprospect'。方法名称必须以findBy或findOneBy开头

时间:2016-03-10 10:42:26

标签: symfony

我收到此错误:未定义的方法'rechercheprospect'。方法名称必须以findBy或findOneBy

开头

这是我的ProspectRepository:

<?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;
}
}

这是我的实体:展望

<?php

namespace Ass\AssurBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Prospect
*
* @ORM\Table(name="prospect")
* @ORM\Entity(repositoryClass="Ass\AssurBundle\Entity\ProspectRepository")
*/
class Prospect
{

这是我的控制器,我称之为存储库:

$prosp = $this->getDoctrine()
              ->getManager()
              ->getRepository("AssAssurBundle:Prospect")
              ->rechercheprospect('sante');

任何帮助???? 提前致谢

0 个答案:

没有答案