Advanced Service Container Utilizationby Richard Miller (@mr_r_miller)
View Slide
Getting the most from the Symfony2service container
Knowing the injectionoptions open to you
You may get to inject into the constructor
You might get to Inject into setter methods
You may have to inject into properties
You can integrate objectscreated by factories
You may need to integrate astatic factory method
You can configure the container touse the factory method
You may be dealing with aseparate factory object
You can also accommodate thiswith container configuration
Saving time by reducing the amount ofconfiguration you have to write
The wrong way with interface injection
What is interface injection?
How is interface injection configured?
Why you can't use it
The right way with parent services
You can have parent classes toreduce code repetition
You can also have a parent service toreduce repetitive configuration
You can change configurationindependently from code
Understanding the service containercompilation process
You need to call compile if using thecomponent outside the framework
You get to load complexconfig from extensions
Using compiler passes to respondto other configuration
What if you want to use servicesfrom other bundles?
You need to dynamically registerthe tagged services
You can register compiler passesfrom bundles in the framework
Dumping the compiled containerfor performance
You get the performance benefits bycaching the dumped container
You get convenience as well by avoidingthe cache in debug mode
Questions?@mr_r_millerrichardmiller.co.uk