This code is working fine in controller
$em = $this->getDoctrine()->getEntityManager();
$entity = $em->getRepository('AcmeUserBundle:Child')->find($id);
Now I have custom Repository class
I want to know that how can use that in there
function getUser()
{
$em = $this->getEntityManager();
$entity = $em->getRepository('AcmeUserBundle:Child')->find($id);
}
Do I still need to use getRepository in Repository as well or not?
If the method is in
Repositoryclass, then you could just use$this.