Aha, well we could add to the injector interface, something like:
function getInstance( ofClass, named:String = null ):*;
But obviously that turns the injector back into a model/service
locator - which leads straight back to:
Untyped registry.. no type hinting.. lots of casting
Extra knowledge (naming scheme) and code required at every touch
point.. duplication... knowledge smear
Reminds me of _root["menuItem"+i]
I feel that, on the Model side, this style can (and should) be
avoided. Often, a bunch of value objects belong in a collection - a
single collection (in that context/application), that could be
accessed through one Proxy. I don't think that they should be thrown,
side-by-side, into a registry, and accessed by string keys.
At the same time, I do understand that it's convenient. And at the end
of the day, internally, the framework is using the injector like that
anyway, so we may as well expose it for use in really tricky/rushed
situations.
What do you think?
On Jul 17, 4:02 pm, Joel Hooks <
joelho...@gmail.com> wrote:
> No, I still haven't figured it out. Say I have a customer with several
> image galleries they can view, and I want to proxy all of the image
> gallery value objects. In PureMVC I pass a UID to the proxy and then
> override its getProxyName() to include the UID so when I want to refer
> to it I have a unique hook.
>
>
http://forums.puremvc.org/index.php?topic=596.msg3148#msg3148
>
> I can't get my head around how to do this with injection.
>
> Joel Hooks (@jhooks)
http://joelhooks.com