-
Notifications
You must be signed in to change notification settings - Fork 2.5k
added "ControllerManager" Manager, and make "ControllerLoader" as alias of it #4962
added "ControllerManager" Manager, and make "ControllerLoader" as alias of it #4962
Conversation
@samsonasik 👍 , but you should probably also replace usages... |
@Ocramius I replaced usages of 'ControlleLoader' to 'ControllerManager' at library and tests folder, now it is safe to remove 'ControllerLoader' from ModuleManagerFactory because of already aliased. Let me know if something missing ;) |
@@ -14,10 +14,10 @@ | |||
use Zend\ServiceManager\FactoryInterface; |
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.
It might make sense to keep a ControllerLoaderFactory in place that simply extends the ControllerManagerFactory. We would not register the factory -- but that way, if somebody was extending it, it would continue to work.
@weierophinney done ;) |
I'm still worried about BC implications of this. If a developer has created a factory for ControllerLoader, the assumption is fetching the ControllerManager service will fetch that instance -- but with this change, it would not. I'm thinking we may need to bench this one until 3.0. @samsonasik Can you post an email to the zf-contributors mailing list, pointing them to this PR and:
Thanks! |
@weierophinney i have posted here at mailing list here : http://zend-framework-community.634137.n4.nabble.com/Need-PR-review-for-4962-added-quot-ControllerManager-quot-Manager-and-make-quot-ControllerLoader-quo-td4660773.html . Let me know if something missing, Thanks. |
For ZF3 I'm in favour of renaming all this mess to "ControllerPluginManager", "FilterPluginManager"... and so on =). But even, this is somewhere we're not consistent. I love using FQCN for keys, and we use it sometimes even inside the framework ('Zend\Authentication\AuthenticationService' for instance). We need to have a consensus on that =). |
@@ -32,14 +32,14 @@ public function createService(ServiceLocatorInterface $plugins) | |||
)); | |||
} | |||
|
|||
if (!$services->has('ControllerLoader')) { | |||
if (!$services->has('ControllerManager')) { |
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.
Question: do we still need this check?
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.
I think no need, but changing it can be "unrelated" commit for this PR ?
@bakura10 this PR can be a preparation for ZF3, I make an alias of ControllerManager pointed to ControlletLoader to make it's still compatible with current version 2. When ZF3 released, the "ControllerLoader" manager that deprecated can be completely removed. |
I'm not sure how only changing the name will benefit ZF3, when ideally its functionality should also change in order to make it an independent factory, below is along the lines of what I would like/expect to see in ZF3: public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
$controllerConfig = new ControllerManagerConfig($config['controllers']);
$controllerManager = new ControllerManager();
$controllerManager->setServiceLocator($serviceLocator);
$controllerManager->addPeeringServiceManager($serviceLocator);
$controllerConfig->configureServiceManager($controllerManager);
if (isset($config['di']) && isset($config['di']['allowed_controllers']) && $serviceLocator->has('Di')) {
$controllerManager->addAbstractFactory($serviceLocator->get('DiStrictAbstractServiceFactory'));
}
return $controllerManager;
} |
@devosc : +100. I'm advocating using the SM config to create all plugin managers (that's what I'm doing in my ZF3 hydrator refactoring too). This will allow us to remove the infamous ModuleListener class. However we need to have a discussion about this with the team as we loose a feature (the ability to specify config in a Module.php class using the getControllerConfig method - I think it's not a big deal as people can still use the global getServiceConfig). Changing names is just a coherency. ControllerLoader was confusing because most other plugin manager ends up with manager. At the same time we also have some plugin managers that ends with PluginManager (which is the suffix I prefer). It's all those small things that make the framework easier and more coherent to use, even if this is not a feature change. |
@devosc This PR is for preparation for ZF3 for more consistency, just to start consistency with naming. I think the changing code can be applied when starting ZF3 |
The thread started via Nabble didn't come to my inbox, so I'll leave my comment here. Personally, I'd rather see a |
@EvanDotPro can you clarify the specific changes you feel should be made for this PR to be ready to merge? |
ping @EvanDotPro ^^ |
@samsonasik what @EvanDotPro is indicating is:
The rationale is it ensures BC is kept in 2.x. In 3.0, we would change the situation, and make the new name the actual service, and potentially have a "compatibility layer" that would alias the old service names to the new. |
@weierophinney done ;), I keep the original factories, and added alias ( ControlerManager ) for it. Please let me know if I missed something. Thank you. |
added "ControllerManager" Manager, and make "ControllerLoader" as alias of it
- Original commit adds the alias for ControllerManager; this commit updates code to use that alias. Some tests needed to be updated as well.
- while not technically a BC break, should be called out in release notes
I updated code to reference the "ControllerManager" service, including tests, and noted the change in the README. Merged to develop for release with 2.3.0. |
- Original commit adds the alias for ControllerManager; this commit updates code to use that alias. Some tests needed to be updated as well.
re-created in zendframework/zend-mvc#6 |
for consistency, "ControllerLoader" should be named "ControllerManager". It not BC break because of I made new Factory named ControllerManagerFactory and point ControllerLoader as alias of ControllerManager. It can be a preparation for ZF3. When ZF3 released, the "ControllerLoader" manager can be completely removed.