On 3/21/10 2:49 PM, Fabian Lange wrote:
Hi Fabien,i propose the following pattern. Personally I would prefer if you would stop doing magic on variable names. Thats not clean. interface ContainerAware { public function setContainer(Container c); } class MyAction implements ContainerAware { private $userService; public function setContainer(Container c) { $this->userService = c->getService('user.session.pdo'); } } This way would eliminate all magic and be pretty much the way the pattern is implemented in many Java frameworks. I would prefer to use the container in the test though, because that is the way you use it in runtime (we do it with event dispatcher as well in 1.2) if you dont want, you could set the service differently in the test
... which is exactly what we have now in PR1. The only difference is that we inject the container in the constructor, but that's really a detail implementation.
Fabien
Fabian
-- 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 To unsubscribe from this group, send email to symfony-devs+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
