Symfony2 Doctrine Custom Repository Class [Semantical Error] line 0, col 14 near 'Project p': Error: Class 'Project' is not defined
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm really new in Symfony 2 and Doctrine, and have a simple problem: There is a pretty simple code in my repository: <?php namespace BakeryIT\BakeryBundle\Entity; use Doctrine\ORM\EntityRepository; class ProjectRepository extends EntityRepository { public function findHistory(){ return $this->getEntityManager() ->createQueryBuilder() ->select('p') ->from('Project','p') ->getQuery() ->getResult(); } } And two simple functions in my controller: <?php namespace BakeryIT\BakeryBundle\Controller; /* ... */ class ProjectController extends