Hi Phillip G,

The easiest way to get the behaviour your co-worker desires is to use
service manager factories. You can create a factory for your controller,
and inject the service there. Then you will be able to do
$this->getPlatformObject() as expected.

Kind Regards,

Michael Gooden


On 24 August 2013 00:21, Philip G <guice...@gmail.com> wrote:

> On Fri, Aug 23, 2013 at 3:05 PM, Matthew Weier O'Phinney
> <matt...@zend.com>wrote:
>
> > Just for argument's sake, why are you using Zend\Di instead of
> > Zend\ServiceManager? Is there a compelling reason?
> >
> >
> Purely for the sake of a co-worker's request and desire. He didn't like
> hard coding of a ServiceManager alias name, even if it was an alias. He
> comes from a Java background and rather see DI than SM aliases.
>
> However, if there is a compelling reason to use SM over DI with ZFW, I
> could easily convince him otherwise.
>
> In my example, I originally use $sm->get('Firmware\PlatformObject'); and it
> does work perfectly. And he just rather see: $this->getPlatformObject()
> where platformObject is injected into our controller by the framework. I
> wanted to compare the two different approaches, and select the best option.
>
> ---
> Philip
> g...@gpcentre.net
> http://www.gpcentre.net/
>

Reply via email to