ZF2 Registry, Dependency Injection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ZF2 Registry, Dependency Injection

EHaskins
This post has NOT been accepted by the mailing list yet.
Hey all,

What is the best way or the way to implement a registry type solution. My new app is SaaS and has multiple domains pointing to it so on load I need to build an object/array of settings pertaining to the site_id that need to be accessed thru out the app. Outside of Zend I would have a registry object.

Thx for any snippets or ideas if I am repeating others I am sorry I have been researching ideas all weekend and try not to repeat

Eric
Reply | Threaded
Open this post in threaded view
|

Re: ZF2 Registry, Dependency Injection

Ingo
This post has NOT been accepted by the mailing list yet.
Hey,

The Registry implementation has been removed from ZF2 due to the known registry implementation issues. You can easily provide a own written solution with a static member as global data storage and access it from everywhere. The goods for the registry pattern are the bads at the same time (most likely) - and you might have a big overhead with injecting that needed object to every component. Of course, you can provide it as a service, register it and fetch it everywhere from the servicemanager but that depends on your base architecture and the requirements for this object. If you want to use it everywhere, look at the ServiceManager and the ServiceManager\ConfigInterface. The thoughts behind some components has changed very much from ZF1.

Regards