【发布时间】:2016-08-17 08:40:51
【问题描述】:
我无法从数据库中获取数据。代码如下:
$testRepository= $this->getDoctrine()->getRepository('testBundle:test');
$potds = $testRepository->findBy(
array(),
);
这是实体类:
* @ORM\Table()
* @ORM\Entity(repositoryClass="testBundle\Entity\test")
* @ORM\HasLifecycleCallbacks
*/
class test
{ /* ... */ }
这是存储库的代码:
namespace testBundle\Entity;
/**
* TestRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class testRepository extends \Doctrine\ORM\EntityRepository
{
}
我收到此错误消息:symfony 2 - Attempted to call an undefined method named "findBy" of class "testBundle\Entity\test"
使用 Doctrine 插入数据是可行的,因此实体应该一切正常。
【问题讨论】:
-
请提供Repository的代码和路径
标签: php symfony doctrine-orm