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

Code refactor with the new servicemanager of ZF3 #49

Merged

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Jan 7, 2016

This PR includes the code refactor with the new zend-servicemanager of ZF3.

@@ -39,7 +41,7 @@ public static function setPluginManager(ValidatorPluginManager $plugins = null)
public static function getPluginManager()
{
if (null === static::$plugins) {
static::setPluginManager(new ValidatorPluginManager());
static::setPluginManager(new ValidatorPluginManager(new ServiceManager));
Copy link
Member

Choose a reason for hiding this comment

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

This is a very common pattern repeated across all SM v3 PRs. May the SM should be injected by default?

Copy link
Member

Choose a reason for hiding this comment

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

@Maks3w note the context here: static usage. By very definition, no instance is available.

Within the MVC and the various plugin manager factories, the SM will be injected by default; that's the new design. (Instead of passing it to setServiceLocator(), it becomes a constructor argument, and becomes the "creation context", which means that it is that instance, not the plugin manager, passed to factories.)

@weierophinney weierophinney modified the milestones: 2.6.0, 3.0.0 Jan 7, 2016
@weierophinney weierophinney self-assigned this Jan 7, 2016
@weierophinney
Copy link
Member

I'm marking this as 3.0 temporarily. Once zendframework/zend-servicemanager#59 is finalized and merged, we can likely do some modifications to make this a forwards-compat update for the next minor version.

@weierophinney weierophinney merged commit a98d7f6 into zendframework:develop Jan 7, 2016
weierophinney added a commit that referenced this pull request Jan 7, 2016
Code refactor with the new servicemanager of ZF3
weierophinney added a commit that referenced this pull request Jan 7, 2016
weierophinney added a commit that referenced this pull request Jan 7, 2016
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.

3 participants