nedwave/rest-bundle

Nedwave Rest Bundle

Installs: 111

Dependents: 0

Stars: 1

Watchers: 1

Open Issues: 1

Language: PHP

v3.2.0 2015-05-26 08:01 UTC

README

Nedwave Rest Bundle

Installation

Install package with composer

"nedwave/rest-bundle": "*"

Register bundles in AppKernel

new Nedwave\RestBundle\NedwaveRestBundle(),

Update config.yml

framework
    serializer:
        enabled: true

Extend your controllers for use of the json action

<?php

namespace Acme\DemoBundle\Controller;

use Nedwave\RestBundle\Controller\RestController;

class DefaultController extends RestController
{
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('AcmeDemoBundle:Post')->findAll();

        return $this->json($entities);
    }
}