On 21.03.2010, at 14:49, 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
> 

hmm not sure how this is superior to just injecting the services into the 
constructor? seems quite verbose and i am not sure for what gain.

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

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.

Reply via email to