I\'m using Symfony 2 with Doctrine 2 to create a web service(JSON) for an iOS app.
To fetch my entity i do:
$articles = $this->getDoctrine()->g
If you use a doctrine query you can also do this:
$em = $this->getDoctrine()->getEntityManager(); $query = $em->createQuery('SELECT ma FROM UdoPaddujourBundle:MenuArticle ma ...etc'); $myArray = $query->getArrayResult();
and then json_encode($myArray); See here for more details