There's no "proper" way, but given the fact that controller uses container's managed services, it makes sense too to let controller to handle the controller for its dependencies as well as other setups such as interfaces supported by the container being implemented by the controller - e.g. "Initializable", "Disposable", etc.
However, one can argue that controller's lifecycle is actually managed by the MVC framework/front-controller/dispatcher rather than making it a reusable service. For that case, we can look at the positive side that we are creating more options, as there's always more than one way to do something. Yuen-Chi Lian | www.yclian.com "I do not seek; I find." - Pablo Picasso On Thu, Sep 23, 2010 at 6:15 PM, Fabien Potencier < [email protected]> wrote: > On 9/23/10 11:57 AM, Lukas Kahwe Smith wrote: > >> >> On 23.09.2010, at 09:25, Jordi Boggiano wrote: >> >> On 23.09.2010 08:43, Fabien Potencier wrote: >>> >>>> I don't want to force the usage of services as controllers as it means >>>> that you need to add a new service in the configuration each time you >>>> create a new controller. That's just too much work for beginners and too >>>> many things to understand to get started. That should be an option >>>> though for all the reasons you and some others mentioned. >>>> >>> >>> I'm not sure it's worth it for beginners tbh. I mean it's only good for >>> a "build your symfony hello world in 10minutes" article, but beyond that >>> people will be forced to go in the config to enable a service, or change >>> a parameter, and sooner or later they'll most likely have to be able to >>> create bundles and know about the whole service definition. >>> >>> I just think it might send the wrong signal to people and that later >>> they have to do it right and convert all their routes, define all their >>> controllers as services and change their controllers to use injected >>> services instead of receiving the SC. I'd rather have a slightly steeper >>> learning curve without gotchas later on. >>> >> >> >> Yeah, I agree. Maybe we can have a trainee setup. Something to get up and >> running quickly, but that we do not encourage to use in production. So the >> jobeet tutorial for Symfony2 would begin with this simplified approach >> without configuration. Then after explaining all the other aspects, they are >> told to change to the "proper" way. I just feel that if we let this feature >> in to help beginners, those same beginners will get burned one day, where >> they then have to change all their code at once. >> > > I'm still not sure that using services for controllers is the "proper" way. > Anyway, it's at least now possible to use services. > > Fabien > > > -- > 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]<symfony-devs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- 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
