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

Backwards compatibility for hydrators #54

Merged
merged 3 commits into from
Feb 16, 2016

Conversation

weierophinney
Copy link
Member

As noted in zendframework/zendframework#7672, on updating to:

  • zend-stdlib >= 2.7.0
  • zend-mvc >= 2.6.0

backwards compatibility is broken with regards to typehints against hydrators. The reason is two-fold:

  • The HydratorPluginManager is simply an extension of the one provided in zend-hydrator, meaning that all plugins returned are under the Zend\Hydrator namespace, not the Zend\Stdlib\Hydrator namespace.
  • zend-mvc altered the HydratorPluginManager mapping to use the instance from zend-hydrator instead of zend-stdlib.

This patch addresses the first point of each. It does the following:

  • Updates the DelegatingHydratorFactory to return a zend-stdlib instance.
  • Updates the HydratorPluginManager to override the defaults from zend-hydrator, and have them return zend-stdlib extensions.
  • Adds a test suite for HydratorPluginManager to verify backwards compatibility.

A related commit against the zend-mvc 2.6 series will occur shortly, having it use the zend-stdlib HydratorPluginManager.

@weierophinney weierophinney added this to the 2.7.5 milestone Feb 16, 2016
Overrides the zend-hydrator plugins to use the extensions provided in
this repository. This preserves the original typehints, allowing
developers to gradually migrate by replacing zend-stdlib typehints with
zend-hydrator typehints.
As noted in zendframework/zendframework#7672, on updating to:

- zend-stdlib >= 2.7.0
- zend-mvc >= 2.6.0

backwards compatibility is broken with regards to typehints against hydrators.
The reason is two-fold:

- The `HydratorPluginManager` is simply an extension of the one provided in
  zend-hydrator, meaning that all plugins returned are under the `Zend\Hydrator`
  namespace, not the `Zend\Stdlib\Hydrator` namespace.
- zend-mvc altered the `HydratorPluginManager` mapping to use the instance from
  zend-hydrator instead of zend-stdlib.

This patch addresses the first point of each. It does the following:

- Updates the DelegatingHydratorFactory to return a zend-stdlib instance.
- Updates the HydratorPluginManager to override the defaults from zend-hydrator,
  and have them return zend-stdlib extensions.
- Adds a test suite for HydratorPluginManager to verify backwards compatibility.

A related commit against the zend-mvc 2.6 series will occur shortly, having it
use the zend-stdlib HydratorPluginManager.
- Added `COMPOSER_ROOT_VERSION` directive to composer install, to ensure we
  don't get a circular dependency issue.
- PHP 7 MUST pass!
@weierophinney weierophinney merged commit e835e38 into zendframework:release-2.7 Feb 16, 2016
weierophinney added a commit that referenced this pull request Feb 16, 2016
weierophinney added a commit that referenced this pull request Feb 16, 2016
@weierophinney weierophinney deleted the hotfix/7672 branch February 16, 2016 18:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant