Php 实体/存储库中的类\u父级错误

Php 实体/存储库中的类\u父级错误,php,doctrine-orm,symfony-2.1,Php,Doctrine Orm,Symfony 2.1,在我正在开发并正常工作的捆绑包中,我添加了一个新功能,包括向实体添加存储库。现在,当我执行新添加的方法时,我得到以下错误: 警告:class_parents[function.class parents]:类cmspage不存在,无法加载到/Applications/MAMP/htdocs/symfony-standard-2.1/vendor/doctor/common/lib/doctor/common/Persistence/Mapping/RuntimeReflectionService

在我正在开发并正常工作的捆绑包中,我添加了一个新功能,包括向实体添加存储库。现在,当我执行新添加的方法时,我得到以下错误:

警告:class_parents[function.class parents]:类cmspage不存在,无法加载到/Applications/MAMP/htdocs/symfony-standard-2.1/vendor/doctor/common/lib/doctor/common/Persistence/Mapping/RuntimeReflectionService.php第40行

新增代码为:

控制器:

/**
 * Returns an json formated tree
 * 
 * @Route("/getTree", name="admin_cmsPages_getTree", options={"expose"=true})
 */
public function getTreeAction()
{

    $em = $this->getDoctrine()->getManager();
    $tree = $em->getRepository('CmsPages')->loadTree();


    $response = new Response(json_encode( $tree ));
    $response->headers->set('Content-Type', 'application/json');

    return $response;
}
存储库:

namespace Yanic\CmsBundle\Entity;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NoResultException;

class CmsPagesRepository extends EntityRepository
{
    public function loadTree()
    {
        $q = $this
            ->createQueryBuilder('p')
            ->select('p')
            ->orderBy( 'p.lft' )
            ->getQuery()
            ;

        return $q->getArrayResult();
    }
}
这就是改变的一切。。。如果有任何更多的代码需要澄清,我会张贴它

有人能告诉我我做错了什么吗?我在SO和Google上都找不到任何东西


提前谢谢

我自己刚刚发现了错误。。。线路

$tree = $em->getRepository('CmsPages')->loadTree();
一定是

$tree = $em->getRepository('CmsBundle:CmsPages')->loadTree();

我只是自己发现了错误。。。线路

$tree = $em->getRepository('CmsPages')->loadTree();
一定是

$tree = $em->getRepository('CmsBundle:CmsPages')->loadTree();

可能对你有用:可能对你有用: