Wait, what? We only just started and we are refactoring? What is this madness?
Absolutely we are refactoring. Keeping our code lean, mean, and green is vitally important to keep our project healthy and clean. It's also a breeze, because our awesome test suite has our back so we can refactor with confidence.
Even though it's very early days, our code is already starting to show signs of duplication, especially in our test suite. We want to eliminate as much duplication as possible, primarily for our own sanity, but also because we don't want to be changing multiple locations whenever parts of our code base changes.
Next up, we will cover the basics of documenting our API using the incredible Nelmio API Documentation bundle. This is used to generate some super nice API docs for us by way of our PHP DocBlocks. It's simple enough to use, and we will keep coming back to it throughout the course as we add and update our API end points.
Then we move on to FOS REST Bundle View Listeners. This is very similar in usage to the Sensio Framework Extra Bundle, which you may well have used for handy short cuts in your Symfony 2 controllers like routing annotations and param convertors. Inside FOS REST Bundle, the view listener is the way that our code will know whether to show a JSON response, or an XML response, or a HTML response - or whatever other kind of response we specify.
Ultimately, as mentioned in the intro to this course, the idea is that first we learn how FOS REST Bundle works in a verbose way, and then once we have an understanding of the basics, we can more confidently start using the short cuts to save time and save additional lines on unnecessary code.
If you have found this video helpful, please consider sharing. I really appreciate it.
|3||GET Handled, thin Controllers and fun with Services||17:49|
|4||Automatic Route Generation||11:32|
|5||GETting a Collection||12:53|
|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|