Dear Symfony2 Developers, In my recent article on Interface Injection<http://avalanche123.com/post/1221451286/interface-injection-and-symfony2-dic> I proposed it to be implemented in Symfony2 DIC Component. In short, this is a know type of Dependency Injection that is not yet supported by Symfony2 DIC. It let's you specify what dependencies certain interface or class needs, and whenever you register services of that type, the DIC knows to insert required dependencies. A good example could be the ContainerAwareInterface, that requires $container in its ->setContainer() method. As part of my proposal, to make it more understandable, I have created a prototype implementation here: http://github.com/avalanche123/symfony/commits/interface_injection The limitations of my implementations are:
- interface injectors cannot be dumped (to xml or php) - this should be fairly easy to implement, since injectors are stored in array on ContainerBuilder - when interface injectors are removed from container, their injection method calls stay on all definitions, corresponding to that interface, and are simply not added to newly registered definitions - this is architectural decision in my implementation and cannot be fixed unless interface injection is implemented differently (right now all an injector does is checks whether Definition::getClass() is instance of InterfaceInjector::getClass(), and decorates Definition with its methodCalls, which is irreversible when injector is removed). The removal of method calls with the removal of inject might not even be necessary, but its a decision that needs to be made. So please read my post as its the most complete description of the problem and justification of Interface Injection implementation advantages. Then please provide feedback here on the matter. Thanks Everyone! Bulat (avalanche123) Shakirzyanov -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
