Hi,

Is there are any way to get ServiceLocator or other DI manager in other
classes, Model classes  for example?

I read "Creating a ServiceManager-aware
class"<http://zf2.readthedocs.org/en/latest/modules/zend.service-manager.quick-start.html>,
It's fine, but it works only with controllers.
It'd be fine if this will work with other classes instantiated with
ServiceLocator/Manager. for example:

I have some configured invocable class: myClass described as follow:

class myClass implements ServiceManagerAwareInterface {
private $serviceManager=null;

...
}

, in controller i use serviceLocator to get it

$myClassObj = $serviceLocator->get('myClass')

,so after getting $myClassObj it will have instance of $serviceManager
which in it's turn can use it to get other resources.


And another question. Is there are any way to pass parameters to resources
described in Module.php when they are initialized? I mean while i do
something like
$myClassObj = $serviceLocator->get('myClass' , ...????....)

and process it in factories section(getServiceConfig) or in some other one?


Thank you.

Maxim Savenko
[email protected]

Reply via email to