Artur, Thank you for your input. It's been very informative!
Julian. > It's not against it. > It's still an "Inversion of Control" way of doing things, which is a good > thing. > > ZF2 DI has been in active development in late 2011 and has gained a lot of > traction among contributors. At some point though, the performance and > config files' complexity became an issue. That's why ServiceManager idea has > been brought up. > > Up until beta1 (AFAIR) nearly everything was defined in DI and config files > were humongous. Applications were slow, memory usage was through the roof, > the complexity actually rose as compared to ZF1 Application_Service or > similar. There were ideas on how to further optimise DI, but a group of > contributors came up with another idea: SM. > > ServiceManager allows for more explicit way of building up services. For > example, instead of an array of arrays with 20 keys (which is required for > DI to be able to handle dependencies correctly and construct objects), you > can just use a _single_ factory function/class with a few "new This", "new > That" and "return $service" at the end. > > There's no strict policy or recommendation against SM nor DI. Both are OK, > both have strengths and weaknesses. It's your choice which you'll use. Both > are recognised by Zend\Mvc and will be read from you app config. > > As for modules - each module's author decides on which method to use. Again > - both are valid ways of handling dependencies and automatically > constructing instances. Evan chose SM factories in this example. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
