Hi all!

I'm currently developing a web application with ZF2. I started some months
ago and use $this->getServiceLocator() in controller to access to my service
like described in the doc.

/Example in the doc:/



It work well! But i read on different discussion that it will may be removed
in ZF3 and is better to inject all what you need in your controller directly
in the constructor like this:


/Example:/



So my question is easy.. *What is the best practice ?* (performance,
migration, ...)


Some sources:
https://github.com/zendframework/zf2/issues/5168
http://macnibblet.blogspot.se/2013/10/why-i-wish-to-remove-getservicelocator.html


Thanks in advance,
Michael



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Best-practice-to-get-service-in-controller-tp4661350.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to