-
Notifications
You must be signed in to change notification settings - Fork 91
[ZF3] [bc-break] remove ControllerLoader, use ControllerManager instead #6
Changes from all commits
9d78688
00367b4
e875a0a
5e0828c
73c94e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,10 @@ | |
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
class ControllerLoaderFactory implements FactoryInterface | ||
class ControllerManagerFactory implements FactoryInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add description with the purpose of the class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any suggestion description ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following the SRP of SOLID describe what is this class responsible There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
{ | ||
/** | ||
* Create the controller loader service | ||
* Create the controller manager service | ||
* | ||
* Creates and returns an instance of ControllerManager. The | ||
* only controllers this manager will allow are those defined in the | ||
|
@@ -33,16 +33,16 @@ class ControllerLoaderFactory implements FactoryInterface | |
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$controllerLoader = new ControllerManager(); | ||
$controllerLoader->setServiceLocator($serviceLocator); | ||
$controllerLoader->addPeeringServiceManager($serviceLocator); | ||
$controllerManager = new ControllerManager(); | ||
$controllerManager->setServiceLocator($serviceLocator); | ||
$controllerManager->addPeeringServiceManager($serviceLocator); | ||
|
||
$config = $serviceLocator->get('Config'); | ||
|
||
if (isset($config['di']) && isset($config['di']['allowed_controllers']) && $serviceLocator->has('Di')) { | ||
$controllerLoader->addAbstractFactory($serviceLocator->get('DiStrictAbstractServiceFactory')); | ||
$controllerManager->addAbstractFactory($serviceLocator->get('DiStrictAbstractServiceFactory')); | ||
} | ||
|
||
return $controllerLoader; | ||
return $controllerManager; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ class ServiceListenerFactory implements FactoryInterface | |
'factories' => [ | ||
'Application' => 'Zend\Mvc\Service\ApplicationFactory', | ||
'Config' => 'Zend\Mvc\Service\ConfigFactory', | ||
'ControllerLoader' => 'Zend\Mvc\Service\ControllerLoaderFactory', | ||
'ControllerManager' => 'Zend\Mvc\Service\ControllerManagerFactory', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old key must be preserved for bc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now it for 3.0, can be actually removed. |
||
'ControllerPluginManager' => 'Zend\Mvc\Service\ControllerPluginManagerFactory', | ||
'ConsoleAdapter' => 'Zend\Mvc\Service\ConsoleAdapterFactory', | ||
'ConsoleRouter' => 'Zend\Mvc\Service\RouterFactory', | ||
|
@@ -94,7 +94,6 @@ class ServiceListenerFactory implements FactoryInterface | |
'Zend\View\Resolver\TemplatePathStack' => 'ViewTemplatePathStack', | ||
'Zend\View\Resolver\AggregateResolver' => 'ViewResolver', | ||
'Zend\View\Resolver\ResolverInterface' => 'ViewResolver', | ||
'ControllerManager' => 'ControllerLoader', | ||
], | ||
'abstract_factories' => [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, at ZF3, the old one ( ControllerLoader ) will no longer used. zendframework/zendframework#4962 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to add back closing "]", fixed now |
||
'Zend\Form\FormAbstractServiceFactory', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead create a new class and inherit the old one from the new one. By this way BC is preserved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is for ZF3, I thik it is ok to remove the old one /cc @weierophinney
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do it and this could be merged in 2.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, and
ControllerLoaderFactory
marked as @deprecated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as zendframework/zend-authentication#2 (comment) , ControllerLoader actually removed for 3.0