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

Allow usage with zend-hydrator v3 #224

Merged

Conversation

weierophinney
Copy link
Member

This patch provides compatibility with zend-hydrator v3, while retaining compatibility with versions 1 and 2.

The primary change that affects this package is that the default shipped hydrators were given the suffix Hydrator. The original still exist, but emit deprecation notices when used.

The Fieldset class is the only one in the source library that references a specific hydrator. That reference was changed to check if the v3 variant exists, using that when found and the v1/v2 variant otherwise. Additionally, due to the stricter typehints in zend-hydrator v3, a check was necessary within bindValues() for a populated $object property prior to attemting hydration.

The bulk of the effort was getting the tests to pass with both versions, as the deprecation notices can prevent test passage when v3 is installed. All tests were updated to vary hydrator usage based on zend-hydrator version installed. In a number of cases, test assets were duplicated when varying was impossible to perform programmatically; for these cases, I provided autoload-dev rules that perform class aliases.

zend-hydrator v3 is essentially backwards compatible for consumers.
This patch adds version 3 to the allowed zend-hydrator versions, and
updates the travis configuration to add zend-hydrator as a legacy
dependency in locked versions prior to PHP 7.2.
This patch provides compatibility with zend-hydrator v3, while retaining
compatibility with versions 1 and 2.

The primary change that affects this package is that the default shipped
hydrators were given the suffix `Hydrator`. The original still exist,
but emit deprecation notices when used.

The `Fieldset` class is the only one in the source library that
references a specific hydrator. That reference was changed to check if
the v3 variant exists, using that when found and the v1/v2 variant
otherwise. Additionally, due to the stricter typehints in zend-hydrator
v3, a check was necessary within `bindValues()` for a populated
`$object` property prior to attemting hydration.

The bulk of the effort was getting the tests to pass with both versions,
as the deprecation notices can prevent test passage when v3 is
installed. All tests were updated to vary hydrator usage based on
zend-hydrator version installed. In a number of cases, test assets were
duplicated when varying was impossible to perform programmatically; for
these cases, I provided autoload-dev rules that perform class aliases.
The current composer.lock includes zend-math 3.2, which requires
a pargonie/random_compat version that is incompatible with PHP 5.6.
- due to zend-hydrator v3/v2 differences
@weierophinney weierophinney force-pushed the feature/zend-hydrator-v3 branch from e683f03 to c51062d Compare December 11, 2018 22:41
@weierophinney weierophinney merged commit c51062d into zendframework:develop Dec 11, 2018
weierophinney added a commit that referenced this pull request Dec 11, 2018
weierophinney added a commit that referenced this pull request Dec 11, 2018
@weierophinney weierophinney deleted the feature/zend-hydrator-v3 branch December 11, 2018 22:52
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.

1 participant