Answer the question
In order to leave comments, you need to log in
How to access repository in entity?
Tried to follow this example:
use Doctrine\ORM\EntityManager;
class Someclass {
private $entityManager;
public function __construct(EntityManager $entityManager)
{
$this->entityManager = $entityManager;
}
public function someMethod()
{
$customer = $this->entityManager
->getRepository('Acme\CustomerBundle\Entity\Customer')
->findOneBy(...);
}
}
Error: Call to a member function getRepository() on null
Answer the question
In order to leave comments, you need to log in
How to access repository in entity?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question