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

AbstractFactory consistency #4364

Conversation

weierophinney
Copy link
Member

This PR aims to bring consistency to the various abstract factory implementations that have been created for 2.2.0. In particular:

  • No abstract factory requires a factory-specific service prefix (e.g., Form\\, Logger\\, ``SessionContainer\`, etc.). The chances of collision are relatively slim, particularly with strong naming.
  • All abstract factories support extension, typically by allowing overriding a $configKey property or the getConfig() method. This allows re-purposing the factories to use alternate configuration when desired.
  • All abstract factories now have the AbstractServiceFactory suffix. This was already in use for the Di abstract factory, so it made sense to go with established naming.

- No longer needs "SessionContainer\\" prefix
... by extending the abstract factory and overriding the $configKey
property.
... same as was done for session containers

- Also caches configuration
- Allows changing the configuration key via extension
- also made cache configuration key configurable, via extension
- Consistent getConfig() usage
- Consistent naming
- We'd already started using the suffix "AbstractServiceFactory"; made
  this consistent on all new factories.
- Updated the SessionManager configuration to the new names, and added
  Logger and Cache to the configuration.
- Not quite the same; you need to override getConfig() as it uses a
  subkey, and not a top-level key. Overall, though, much closer in
  design.
- trailing whitespace
@@ -13,22 +13,22 @@
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class FormAbstractFactory implements AbstractFactoryInterface
class FormAbstractServiceFactory implements AbstractFactoryInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be better to create a new subnamespace? -> Zend\Form\Service\FormAbstractFactory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Because the FormElementManager is already in the component root namespace, it makes no sense to create a new subnamespace. If we'd anticipated multiple SM-related factories originally, yes.

ralphschindler pushed a commit that referenced this pull request Apr 30, 2013
Merge branch 'hotfix/abstract-manager-prefix-removal' of git://github.com/weierophinney/zf2 into weierophinney-hotfix/abstract-manager-prefix-removal
ralphschindler pushed a commit that referenced this pull request Apr 30, 2013
Merge branch 'weierophinney-hotfix/abstract-manager-prefix-removal' into develop
@ralphschindler ralphschindler merged commit e928062 into zendframework:develop Apr 30, 2013
gianarb pushed a commit to zendframework/zend-session that referenced this pull request May 15, 2015
Merge branch 'hotfix/abstract-manager-prefix-removal' of git://github.com/weierophinney/zf2 into weierophinney-hotfix/abstract-manager-prefix-removal
gianarb pushed a commit to zendframework/zend-session that referenced this pull request May 15, 2015
Merge branch 'weierophinney-hotfix/abstract-manager-prefix-removal' into develop
gianarb pushed a commit to zendframework/zend-log that referenced this pull request May 15, 2015
Merge branch 'hotfix/abstract-manager-prefix-removal' of git://github.com/weierophinney/zf2 into weierophinney-hotfix/abstract-manager-prefix-removal
gianarb pushed a commit to zendframework/zend-log that referenced this pull request May 15, 2015
Merge branch 'weierophinney-hotfix/abstract-manager-prefix-removal' into develop
gianarb pushed a commit to zendframework/zend-cache that referenced this pull request May 15, 2015
Merge branch 'hotfix/abstract-manager-prefix-removal' of git://github.com/weierophinney/zf2 into weierophinney-hotfix/abstract-manager-prefix-removal
gianarb pushed a commit to zendframework/zend-cache that referenced this pull request May 15, 2015
Merge branch 'weierophinney-hotfix/abstract-manager-prefix-removal' into develop
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants