On 04.12.2010, at 17:02, Marijn wrote: > Now I understand the arguments that lead us to create a > ContainerAwareInterface for controllers but wouldn't we be better of > if we would just inject services into our controllers.
Well some people prefer injecting the container instance others prefer explicit injection. I am in the later camp, but arguments can be found for either approach. > At that point it is the developers responsibility to ensure that those > services are used for those actions. If they might not be used, then > there is probably happening to much in that controller anyway. > Besides that there are the other widely known arguments regarding > testing. > One could even argue to use one class per action (which I still think > is a relatively small cost but works great given you can still have a > common base class to share methods and as a side-effect create really > lean controller objects). Emailing is one of those services that will often be optional if one groups multiple actions inside a single controller. Now one could argue that to send an email one would simply have to forward to an "email controller", which might be feasible for some indeed and remove the need for this rarely used and expensive swift mailer service. Now as for the proxy approach its easy to simply provide a proxied and a non proxied service. Of course the optimal approach would be that all services are lightweight to begin with, but its not always possible to have this be the case for useful 3rd party functionality. As a result imho we might even want to ship Symfony2 with a generic proxy wrapper to assist in lazy loading heavy dependencies. regards, Lukas Kahwe Smith [email protected] -- 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
