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

Forwards-compatibility changes #60

Merged
merged 2 commits into from
Jan 8, 2016

Conversation

weierophinney
Copy link
Member

This patch provides forwards compatibility features for the v2 series to allow users to update their code for use with v3 prior to an actual migration.

AbstractPluginManager

This patch modifies the AbstractPluginManager constructor to allow the following combination of arguments:

  • No arguments (current behavior).
  • Single ConfigInterface argument (current behavior); used to configure the instance.
  • Single ContainerInterface argument (v3 behavior); sets the "parent" locator/"creation context"
  • ContainerInterface as first argument, array as second (v3 behavior); sets the "parent" locator/"creation context", and uses the second argument to configure the instance.

These changes allow developers the ability to continue to use existing plugin managers when upgrading to v3 (though they will also need to implement a validate() method, which will be in the migration guide).

The changes presented are backwards compatible (loosens typehint on initial argument; new, second argument is optional), and are based on changes being implemented in #59.

InvokableFactory

The InvokableFactory introduced in the develop branch is compatible with v2 as well, and this patch adapts it for use with v2. This will allow existing component refactors to retain changes that introduce the InvokableFactory + aliases.

This patch modifies the `AbstractPluginManager` constructor to allow the following combination of arguments:

- No arguments (current behavior).
- Single `ConfigInterface` argument (current behavior); used to configure the instance.
- Single `ContainerInterface` argument (v3 behavior); sets the "parent" locator/"creation context"
- `ContainerInterface` as first argument, array as second (v3 behavior); sets the "parent" locator/"creation context", and uses the second argument to configure the instance.

These changes allow developers the ability to continue to use existing plugin managers when upgrading to v3 (though they will also need to implement a `validate()` method, which will be in the migration guide).

The changes presented are backwards compatible (loosens typehint on initial argument; new, second argument is optional).
Most of the component refactors are complete, and will need to be re-done.
However, one item that should likely be retained is usage of the `InvokableFactory`
for invokable instances. This patch adds that factory to the v2 series,
having it implement `Zend\ServiceManager\FactoryInterface`, but retaining the
defined invokable method from v3. It raises an exception if the `$requestedName`
is not provided, ensuring that any tests against the functionality are using
a `ServiceManager` instance.
@akrabat akrabat merged commit c0655c0 into zendframework:master Jan 8, 2016
akrabat added a commit that referenced this pull request Jan 8, 2016
akrabat added a commit that referenced this pull request Jan 8, 2016
@akrabat
Copy link
Contributor

akrabat commented Jan 8, 2016

Nicely done. Merged to master only as I'm pretty sure that it's not relevant to develop.

@weierophinney weierophinney deleted the hotfix/forwards-compat branch January 11, 2016 18:25
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.

2 participants