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
You can use json_encode($articles) when you entity (or any other object) implements JsonSerializable:
json_encode($articles)
JsonSerializable
$this->getName(), 'description' => $this->getDescription(), ]; } }