On 16.01.2011, at 19:58, Lukas Kahwe Smith wrote:

> 
> On 16.01.2011, at 19:54, Jordi Boggiano wrote:
> 
>> Just to put more code so people that don't do this yet (I think it's
>> just me and lukas.. :) can represent themselves:
>> 
>> # config.yml for FooBundle:
>> 
>> services:
>>   foo.default.controller:
>>       class: Application\FooBundle\Controller\DefaultController
>>       arguments: &foo.controller
>>           - @foo.view
>>           - @request
>>           - @doctrine.orm.entity_manager
>>   foo.other.controller:
>>       class: Application\FooBundle\Controller\OtherController
>>       arguments:
>>           <<: *foo.controller
>>   foo.view:
>>       class: Application\FooBundle\View\FooView
>>       arguments:
>>           - @service_container
>> 
>> # routing.yml for FooBundle:
>> 
>> home:
>>   pattern:  /
>>   defaults: { _controller: foo.default.controller:indexAction }
>> other:
>>   pattern:  /other
>>   defaults: { _controller: foo.other.controller:otherAction }
> 
> 
> Well I wasnt suggesting to push people away from injecting the container is 
> they want or using interface injection or using the LiipViewBundle to make 
> their controllers format agnostic. But yes the point is using services for 
> their controllers, inject what you want however you want it :)


BTW: FOS\UserBundle also uses controllers as services:
https://github.com/FriendsOfSymfony/UserBundle/blob/master/Resources/config/controller.xml

As you can see it makes it easy to keep things extensible, so at least for 3rd 
party Bundles its an absolute must to use services for controllers.

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

Reply via email to