snapshotpl / ZfSnapPhpDebugBar

PHP Debug Bar module for Zend Framework 2 & 3
29 stars 11 forks source link

compatibility with service-manager>=2.7.5 and fixed css #10

Closed bupy7 closed 8 years ago

snapshotpl commented 8 years ago

Why we need to inject locator into this controller?

bupy7 commented 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;
}
snapshotpl commented 8 years ago

But this controller doesn't use any plugin.

bupy7 commented 8 years ago

I mean global plugins for all controllers. Earlier it was possible.

snapshotpl commented 8 years ago

https://zendframework.github.io/zend-mvc/migration/to-v2-7/#servicelocatoraware-initializers