New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forwards-compatibility changes #60

Merged
merged 2 commits into from Jan 8, 2016

Conversation

Projects
None yet
2 participants
@weierophinney
Member

weierophinney commented Jan 5, 2016

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.

Forwards-compatibility changes
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).
Adds the InvokableFactory
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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

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

This comment has been minimized.

Show comment
Hide comment
@akrabat

akrabat Jan 8, 2016

Member

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

Member

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 weierophinney:hotfix/forwards-compat branch Jan 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment