Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

added "ControllerManager" Manager, and make "ControllerLoader" as alias of it #4962

Closed

Conversation

samsonasik
Copy link
Contributor

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.

@Ocramius
Copy link
Member

@samsonasik 👍 , but you should probably also replace usages...

@samsonasik
Copy link
Contributor Author

@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;
Copy link
Member

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.

@samsonasik
Copy link
Contributor Author

@weierophinney done ;)

@weierophinney
Copy link
Member

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:

  • summarize what you are doing
  • explain the BC concerns
  • ask for feedback

Thanks!

@samsonasik
Copy link
Contributor Author

@bakura10
Copy link
Contributor

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')) {
Copy link
Member

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?

Copy link
Contributor Author

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 ?

@samsonasik
Copy link
Contributor Author

@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.

@devosc
Copy link
Contributor

devosc commented Aug 24, 2013

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;
}

@bakura10
Copy link
Contributor

@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.

@samsonasik
Copy link
Contributor Author

@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

@EvanDotPro
Copy link
Member

The thread started via Nabble didn't come to my inbox, so I'll leave my comment here.

Personally, I'd rather see a ControllerManager alias added now rather than changing the class names and everything and aliasing the old to the new. Aliasing the future names to the existing names gives less risk of a BC break in 2.x. I agree with 3.x we should move toward more consistent naming, etc.

@weierophinney
Copy link
Member

@EvanDotPro can you clarify the specific changes you feel should be made for this PR to be ready to merge?

@samsonasik
Copy link
Contributor Author

ping @EvanDotPro ^^

@weierophinney
Copy link
Member

@samsonasik what @EvanDotPro is indicating is:

  • Keep the original factories/services
  • Alias the future names (e.g., ControllerManager) to the present names (i.e. ControllerLoader) (I think this may be the current situation).

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.

@samsonasik
Copy link
Contributor Author

@weierophinney done ;), I keep the original factories, and added alias ( ControlerManager ) for it. Please let me know if I missed something. Thank you.

weierophinney added a commit that referenced this pull request Oct 23, 2013
added "ControllerManager" Manager, and make "ControllerLoader" as alias of it
weierophinney added a commit that referenced this pull request Oct 23, 2013
- Original commit adds the alias for ControllerManager; this commit updates code
  to use that alias. Some tests needed to be updated as well.
weierophinney added a commit that referenced this pull request Oct 23, 2013
- while not technically a BC break, should be called out in release notes
weierophinney added a commit that referenced this pull request Oct 23, 2013
@ghost ghost assigned weierophinney Oct 23, 2013
@weierophinney
Copy link
Member

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.

weierophinney added a commit to zendframework/zend-test that referenced this pull request May 15, 2015
- Original commit adds the alias for ControllerManager; this commit updates code
  to use that alias. Some tests needed to be updated as well.
weierophinney added a commit to zendframework/zend-test that referenced this pull request May 15, 2015
@samsonasik samsonasik deleted the naming.ControllerManager branch June 4, 2015 16:26
@samsonasik
Copy link
Contributor Author

re-created in zendframework/zend-mvc#6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants