Skip to content

unable to get service locator from inside callback function #30

@jackdpeterson

Description

@jackdpeterson

I'm currently implementing some functionality that relies on fetching a Domain service from inside the callback function. What is the appropriate way to get the service manager?

I've defined the invokable class inside of configuration as well as added the ServiceLocatorAwareInterface to my callback class. This is the typical approach that I would expect to work in order to be able to get access to the service manager; however, this does not appear to be the case.

Service "ExampleService" has been requested to plugin manager of type "HumusAmqpModule\PluginManager\Callback",
 but couldn't be retrieved.
A previous exception of type "Zend\ServiceManager\Exception\ServiceNotFoundException" has been raised in the process.
By the way, a service with the name "ExampleService" has been found in the parent service locator "Zend\ServiceManager\ServiceManager": did you forget to use $parentLocator = $serviceLocator->getServiceLocator() in your factory code?

is the exception that is thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions