New videos on making a custom Symfony-based framework hum
Last week we finished up talking about event dispatching in Symfony - a fun way to add easy-to-use hooks in your code - and this week we're tightening up the framework we've been building by adding error reporting and a controller that can return content directly without a response object wrapper. Next, we'll be talking about how a dependency injection container (DIC) can form an important backbone of objects in your project, so stay tuned!
When we instantiate our framework now, we use two different types of dependency injection. We pass two objects in through the constructor, and another through a method in our framework class. We talk briefly about why you would inject dependencies one way or the other here.
In our earlier framework code, we wrapped the execution of our framework in a try … catch block to figure out how and when to display an error on the page. Our new Framework class gives us the same tool, and in this video we look at how to leverage it.
In order to get more control over our response object, we update our controllers to send strings instead of full response objects. To accomplish this feat, we have to adjust a few places in our code.
Having a small front controller means that it’s easier to use multiple front controllers in different environments. Now that we have a clean Framework class, let’s explore putting some of our front controller code into it and see if we can’t tighten up our front controller a bit.
Only 3 weeks left to sign up!
That's right, the clock is ticking. If you're coming to Austin and want to get immersed in Drupal in a fun and ultra productive way, come join us at our training.