I'm using php templates instead of Twig templates in symfony2.3.
Inside this I need to write a doctrine code in PHP template.
So I'm trying to create object for entity manager using following code
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery("SELECT t FROM MyBundle:$TableName t $Condition ");
$result = $query->getArrayResult();
But its not working.