Closed bupy7 closed 8 years ago
Someone would like to use some plugins that uses ServiceLocator of controller. After version the service-manager 2.7.5 it is impossible:
// Zend\Mvc\Controller\AbstractController.php
/**
* Set serviceManager instance
*
* @param ServiceLocatorInterface $serviceLocator
* @return void
*/
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
}
/**
* Retrieve serviceManager instance
*
* @return ServiceLocatorInterface
*/
public function getServiceLocator()
{
trigger_error(sprintf(
'You are retrieving the service locator from within the class %s. Please be aware that '
. 'ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along '
. 'with the ServiceLocatorAwareInitializer. You will need to update your class to accept '
. 'all dependencies at creation, either via constructor arguments or setters, and use '
. 'a factory to perform the injections.',
get_class($this)
), E_USER_DEPRECATED);
return $this->serviceLocator;
}
But this controller doesn't use any plugin.
I mean global plugins for all controllers. Earlier it was possible.
Why we need to inject locator into this controller?