Does anyone know how to pass an instance of a custom Service Manager
between 2 actions? As the Zend Framework 2 documentation says, a SM
will preserve it's instance if the 'shared' option inside the Module.php
class will not be set to false
. However, getting the service manager via $manager = $this->getServiceLocator()->get('MyServiceManager');
in different actions will return different instances of the MyServiceManager
class. What I want to achieve is: I use an API call to a third party service, which obviously returns a response with various information data, however, if the user heads to another action/page where the same data returned previously from the API request is needed would be nice to save it as a MyServiceManager
property and being accessed whenever needed from the class instance if it's set rather that sending another API request every time.
If this is possible, I would be more than happy to listen and learn!