Create Three Symfony Back Ends - Part #18 - Handling POST requests in FOSRESTBundle

preview_player
Показать описание
As our Behat tests rely on being able to "dogfood" our own API in order to run, the most important and immediately urgent task is to get the POST endpoint up and running.

We're going to make use of FOSRESTBundle's Automatic route generation facility to help speed up this process for us. This means we must follow a set convention for controller method naming. If you prefer, manually configured routing is available. We briefly covered this towards the end of the previous video, but as ever, the docs are your friend.

We'll need a few bits in place:

A new Controller class
FOSRESTBundle Routing setup
A postAction
Let's start by adding in the routing setup, as it's really easy.
Рекомендации по теме
Комментарии
Автор

Important: This will not work, the shown code is FOSRestBundle 2.x, but doing the shown composer commands will install 3.x, which is different. you'll have to manually set 2.x version in the composer.json for example, then it will work

christianhabermann