use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

public function jsonAction()
{
$em = $this->getDoctrine()->getManager();

$dql = “SELECT FROM WHERE “;
$query = $em->createQuery($dql);
$array = $query->getArrayResult();
return new JsonResponse(array(‘data’ => $array));
}

Anuncios