Automatic Route Generation

Up until now we've been defining our routes in the usual Symfony manner. In this video we're going to look at how we can cut out a lot of the repetition from our routing.yml file and instead, allow FOS REST Bundle to look at our controllers and determine the available routes from the way our controller actions are named.

The one downside to doing this is that developers new to the project - or more specifically, new to FOS REST Bundle - are going to have an increased learning curve when trying to figure out how and why these routes seem to magically appear, yet aren't explicitly defined anywhere.

I wouldn't normally advocate changing something like this if you're already started with your implementation, but as we have being good TDD developers, we have a way of testing our REST API and as such, we can ensure we aren't going to break any existing functionality by implementing this new routing structure.

We're also going to take a look at the Request Format Listener, one of those scary sounding components that at first seem to add another layer of complexity to an already seemingly large and complex learning process.

Code For This Course

Get the code for this course.

Code For This Video

Get the code for this video.


# Title Duration
1 GETting Started 17:06
2 GETting Refactored 15:39
3 GET Handled, thin Controllers and fun with Services 17:49
4 Automatic Route Generation 11:32
5 GETting a Collection 12:53
6 POSTing 101 11:24
7 Acceptance Testing our POST Method 05:40
8 Unit Testing our Symfony Form 22:55
9 Implementing and Testing the Form Handler 03:01
10 POST Form Handler Implementation 11:12
11 PUT Introduction 07:34
12 PUT Implementation 15:25
13 Pragmatic PATCH 15:17
14 DELETE'ing Things 03:30