BrasserieController.php 836 Bytes
Newer Older
1 2 3 4 5 6 7
<?php

namespace Api2Bundle\Controller;

use Api2Bundle\Entity\Brasserie;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
Mat's avatar
Mat committed
8
use Symfony\Component\HttpFoundation\Request;
9 10 11 12 13 14 15 16 17 18 19 20 21 22

class BrasserieController extends FOSRestController
{
    
    /**
     * @Rest\Get(path="/brasserie")
     * @Rest\View(serializerGroups={"getBrasserie"})
     */
    public function getAction()
    {
        return $this->getDoctrine()
            ->getRepository(Brasserie::class)
            ->findAll();
    }
Mat's avatar
Mat committed
23 24 25 26 27 28 29 30 31 32 33 34 35
    
    
    /**
     * @param Request $request
     * @param $id
     * @Rest\Put(path="/brasserie/{id}")
     * @Rest\View()
     */
    public function putAction(Request $request, Brasserie $id)
    {
        // le fait de typer $id fait qu'il retourne un objet !
        dump($id); die;
    }
36
}