I can't get data out of the database. Here's the code:
$testRepository= $this->getDoctrine()->getRepository('testBundle:test');
$potds = $testRepository->findBy(
array(),
);
Here's the entity class:
* @ORM\Table()
* @ORM\Entity(repositoryClass="testBundle\Entity\test")
* @ORM\HasLifecycleCallbacks
*/
class test
{ /* ... */ }
Here's the code of the Repository:
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
{
}
I get this error message: symfony 2 - Attempted to call an undefined method named "findBy" of class "testBundle\Entity\test"
Inserting data with Doctrine works, so there should be everything right with the Entity.
You have incorrect repository class definition:
@ORM\Entity(repositoryClass="testBundle\Entity\test")
Should be:
@ORM\Entity(repositoryClass="testBundle\Entity\testRepository")
For now this code:
$testRepository= $this->getDoctrine()->getRepository('testBundle:test');
is returning entity class, not repository.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments