zendframework/zend-hydrator
Abandoned; use laminas/laminas-hydrator. Serialize objects to arrays, and vice versa
3.0.2
21M downloads/mo
#2499 most downloaded on Packagist
zendframework/zend-hydrator
What this package is like to depend on
Last release 7 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 13 months
Nearly every release is documented
notes for 15 of 16 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
16 releases · first in 2015
0 releases in the last 12 months
see the full history below
Release timeline
16 releases · Sep 2015 to Oct 2019Releases
latest 16-
3.0.215 Mar 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #103 restores the original behavior of the UnderscoreNamingStrategy with
regards to how numeric characters are treated. In version 2, they were
never used as word boundaries, while version 3.0 used them as word
boundaries in very specific, but hard to predict, scenarios. This release
restores the original behavior from version 2.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #103 restores the original behavior of the UnderscoreNamingStrategy with regards to how numeric characters are treated. In version 2, they were never used as word boundaries, while version 3.0 used them as word boundaries in very specific, but hard to predict, scenarios. This release restores the original behavior from version 2.
-
3.0.107 Jan 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#97 adds a missing
statickeyword toZend\Hydrator\NamingStrategy\MapNamingStrategy::createFromAsymmetricMap,
and simultaneously fixes a mis-spelling of the method name (it incorrectly
used two "s" characters previously, and only one "m" in "asymmetric"). As the
method could not be invoked as documented previously, these changes are
considered bugfixes and not BC breaks. -
#96 fixes issue with integer keys in
ArraySerializableHydrator. Keys are now
cast to strings as we have strict type declaration in the library.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#97 adds a missing
statickeyword toZend\Hydrator\NamingStrategy\MapNamingStrategy::createFromAsymmetricMap, and simultaneously fixes a mis-spelling of the method name (it incorrectly used two "s" characters previously, and only one "m" in "asymmetric"). As the method could not be invoked as documented previously, these changes are considered bugfixes and not BC breaks. -
#96 fixes issue with integer keys in
ArraySerializableHydrator. Keys are now cast to strings as we have strict type declaration in the library.
-
3.0.010 Dec 2018Release notes
Open source →Added
-
#87 adds
Zend\Hydrator\HydratorPluginManagerInterfaceto allow
type-hinting on plugin manager implementations. The interface simply extends
the PSR-11 ContainerInterface. -
#87 adds
Zend\Hydrator\StandaloneHydratorPluginManageras an implementation
of each ofPsr\Container\ContainerInterfaceandZend\Hydrator\HydratorPluginManagerInterface,
along with a factory for creating it,Zend\Hydrator\StandaloneHydratorPluginManagerFactory.
It can act as a replacement forZend\Hydrator\HydratorPluginManager, but
only supports the shipped hydrator implementations. See the plugin manager documentation
for more details on usage. -
#79 adds a third, optional parameter to the
DateTimeFormatterStrategyconstructor.
The parameter is a boolean, and, when enabled, a string that can be parsed by
theDateTimeconstructor will still result in aDateTimeinstance during
hydration, even if the string does not follow the provided date-time format. -
#14 adds the following
finalclasses:\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy\UnderscoreToCamelCaseFilter\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy\CamelCaseToUnderscoreFilter
Changed
-
#89 renames the various hydrators to use the "Hydrator" suffix:
ArraySerializablebecomesArraySerializableHydratorClassMethodsbecomesClassMethodsHydratorObjectPropertybecomesObjectPropertyHydratorReflectionbecomesReflectionHydrator
In each case, the original class was re-added to the repository as a
deprecated extension of the new class, to be removed in version 4.0.0.
Aliases resolving the original class name to the new class were also added to
theHydratorPluginManagerto ensure you can still obtain instances. -
#87 modifies
Zend\Hydrator\ConfigProviderto add a factory entry for
Zend\Hydrator\StandaloneHydratorPluginManager. -
#87 modifies
Zend\Hydrator\ConfigProviderto change the target of the
HydratorManageralias based on the presence of the zend-servicemanager
package; if the package is not available, the target points to
Zend\Hydrator\StandaloneHydratorPluginManagerinstead of
Zend\Hydrator\HydratorPluginManager. -
#83 renames
Zend\Hydrator\FilterEnabledInterfacetoZend\Hydrator\Filter\FilterEnabledInterface(new namespace). -
#83 renames
Zend\Hydrator\NamingStrategyEnabledInterfacetoZend\Hydrator\NamingStrategy\NamingStrategyEnabledInterface(new namespace). -
#83 renames
Zend\Hydrator\StrategyEnabledInterfacetoZend\Hydrator\Strategy\StrategyEnabledInterface(new namespace). -
#82 and #85 change
Zend\Hydrator\NamingStrategy\MapNamingStrategy
in the following ways:- The class is now marked
final. - The constructor is marked private. You can no longer instantiate it directly.
- The class offers three new named constructors; one of these MUST be used to
create an instance, as the constructor is now final:MapNamingStrategy::createFromExtractionMap(array $extractionMap) : MapNamingStrategy
will use the provided extraction map for extraction operations, and flip it
for hydration operations.MapNamingStrategy::createFromHydrationMap(array $hydrationMap) : MapNamingStrategy
will use the provided hydration map for hydration operations, and flip it
for extraction operations.MapNamingStrategy::createFromAssymetricMap(array $extractionMap, array $hydrationMap) : MapNamingStrategy
will use the appropriate map based on the requested operation.
- The class is now marked
-
#80 bumps the minimum supported PHP version to 7.2.
-
#80 bumps the minimum supported zend-eventmanager version to 3.2.1. zend-eventmanager
is only required if you are using theAggregateHydrator. -
#80 bumps the minimum supported zend-serializer version to 2.9.0. zend-serializer is
only required if you are using theSerializableStrategy. -
#80 bumps the minimum supported zend-servicemanager version to 3.3.2.
zend-servicemanager is only required if you are using the
HydratorPluginManagerorDelegatingHydrator. This change means that
some service names supported by zend-servicemanager v2 will no longer work.
When in doubt, use the fully qualified class name, or the class name minus the
namespace, with correct casing. -
#80 adds scalar typehints both to parameters and return values, and object
typehints to parameters, wherever possible. For consumers, this should pose no
discernable change. For those implementing interfaces or extending classes
from this package, updates will be necessary to ensure your code will run.
See the migration guide for details. -
#14 replaces usage of zend-filter with the hardcoded filters referenced in
the above section. -
#14 made the following visibility changes to
\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy:- static property
$underscoreToStudlyCaseFilterwas renamed to$underscoreToCamelCaseFilterand markedprivate - static property
$camelCaseToUnderscoreFilterwas markedprivate - method
getCamelCaseToUnderscoreFilterwas markedprivate - method
getUnderscoreToStudlyCaseFilterwas renamed togetUnderscoreToCamelCaseFilterand markedprivate
- static property
Deprecated
- #89 and
#93 deprecate the
following classes, which will be removed in 4.0.0:Zend\Hydrator\ArraySerializable(becomesArraySerializableHydrator)Zend\Hydrator\ClassMethods(becomesClassMethodsHydrator)Zend\Hydrator\ObjectProperty(becomesObjectPropertyHydrator)Zend\Hydrator\Reflection(becomesReflectionHydrator)
Removed
-
#83 removes the constructor in
Zend\Hydrator\AbstractHydrator. All
initialization is now either performed via property definitions or lazy-loading. -
#82 removes
Zend\Hydrator\NamingStrategy\ArrayMapNamingStrategy. The functionality
it provided has been merged intoZend\Hydrator\NamingStrategy\MapNamingStrategy;
useMapNamingStrategy::createFromExtractionMap()to create an instance that
has the same functionality asArrayMapNamingStrategypreviously provided.
Fixed
- Nothing.
Release notes
Open source →Added
-
#87 adds
Zend\Hydrator\HydratorPluginManagerInterfaceto allow type-hinting on plugin manager implementations. The interface simply extends the PSR-11 ContainerInterface. -
#87 adds
Zend\Hydrator\StandaloneHydratorPluginManageras an implementation of each ofPsr\Container\ContainerInterfaceandZend\Hydrator\HydratorPluginManagerInterface, along with a factory for creating it,Zend\Hydrator\StandaloneHydratorPluginManagerFactory. It can act as a replacement forZend\Hydrator\HydratorPluginManager, but only supports the shipped hydrator implementations. See the plugin manager documentation for more details on usage. -
#79 adds a third, optional parameter to the
DateTimeFormatterStrategyconstructor. The parameter is a boolean, and, when enabled, a string that can be parsed by theDateTimeconstructor will still result in aDateTimeinstance during hydration, even if the string does not follow the provided date-time format. -
#14 adds the following
finalclasses:\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy\UnderscoreToCamelCaseFilter\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy\CamelCaseToUnderscoreFilter
Changed
-
#89 renames the various hydrators to use the "Hydrator" suffix:
ArraySerializablebecomesArraySerializableHydratorClassMethodsbecomesClassMethodsHydratorObjectPropertybecomesObjectPropertyHydratorReflectionbecomesReflectionHydratorIn each case, the original class was re-added to the repository as a deprecated extension of the new class, to be removed in version 4.0.0.
Aliases resolving the original class name to the new class were also added to the
HydratorPluginManagerto ensure you can still obtain instances. -
#87 modifies
Zend\Hydrator\ConfigProviderto add a factory entry forZend\Hydrator\StandaloneHydratorPluginManager. -
#87 modifies
Zend\Hydrator\ConfigProviderto change the target of theHydratorManageralias based on the presence of the zend-servicemanager package; if the package is not available, the target points toZend\Hydrator\StandaloneHydratorPluginManagerinstead ofZend\Hydrator\HydratorPluginManager. -
#83 renames
Zend\Hydrator\FilterEnabledInterfacetoZend\Hydrator\Filter\FilterEnabledInterface(new namespace). -
#83 renames
Zend\Hydrator\NamingStrategyEnabledInterfacetoZend\Hydrator\NamingStrategy\NamingStrategyEnabledInterface(new namespace). -
#83 renames
Zend\Hydrator\StrategyEnabledInterfacetoZend\Hydrator\Strategy\StrategyEnabledInterface(new namespace). -
#82 and #85 change
Zend\Hydrator\NamingStrategy\MapNamingStrategyin the following ways:- The class is now marked
final. - The constructor is marked private. You can no longer instantiate it directly.
- The class offers three new named constructors; one of these MUST be used to
create an instance, as the constructor is now final:
MapNamingStrategy::createFromExtractionMap(array $extractionMap) : MapNamingStrategywill use the provided extraction map for extraction operations, and flip it for hydration operations.MapNamingStrategy::createFromHydrationMap(array $hydrationMap) : MapNamingStrategywill use the provided hydration map for hydration operations, and flip it for extraction operations.MapNamingStrategy::createFromAssymetricMap(array $extractionMap, array $hydrationMap) : MapNamingStrategywill use the appropriate map based on the requested operation.
- The class is now marked
-
#80 bumps the minimum supported PHP version to 7.2.
-
#80 bumps the minimum supported zend-eventmanager version to 3.2.1. zend-eventmanager is only required if you are using the
AggregateHydrator. -
#80 bumps the minimum supported zend-serializer version to 2.9.0. zend-serializer is only required if you are using the
SerializableStrategy. -
#80 bumps the minimum supported zend-servicemanager version to 3.3.2. zend-servicemanager is only required if you are using the
HydratorPluginManagerorDelegatingHydrator. This change means that some service names supported by zend-servicemanager v2 will no longer work. When in doubt, use the fully qualified class name, or the class name minus the namespace, with correct casing. -
#80 adds scalar typehints both to parameters and return values, and object typehints to parameters, wherever possible. For consumers, this should pose no discernable change. For those implementing interfaces or extending classes from this package, updates will be necessary to ensure your code will run. See the migration guide for details.
-
#14 replaces usage of zend-filter with the hardcoded filters referenced in the above section.
-
#14 made the following visibility changes to
\Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy:- static property
$underscoreToStudlyCaseFilterwas renamed to$underscoreToCamelCaseFilterand markedprivate - static property
$camelCaseToUnderscoreFilterwas markedprivate - method
getCamelCaseToUnderscoreFilterwas markedprivate - method
getUnderscoreToStudlyCaseFilterwas renamed togetUnderscoreToCamelCaseFilterand markedprivate
- static property
Deprecated
- #89 and
#93 deprecate the
following classes, which will be removed in 4.0.0:
Zend\Hydrator\ArraySerializable(becomesArraySerializableHydrator)Zend\Hydrator\ClassMethods(becomesClassMethodsHydrator)Zend\Hydrator\ObjectProperty(becomesObjectPropertyHydrator)Zend\Hydrator\Reflection(becomesReflectionHydrator)
Removed
-
#83 removes the constructor in
Zend\Hydrator\AbstractHydrator. All initialization is now either performed via property definitions or lazy-loading. -
#82 removes
Zend\Hydrator\NamingStrategy\ArrayMapNamingStrategy. The functionality it provided has been merged intoZend\Hydrator\NamingStrategy\MapNamingStrategy; useMapNamingStrategy::createFromExtractionMap()to create an instance that has the same functionality asArrayMapNamingStrategypreviously provided.
Fixed
- Nothing.
-
-
2.4.204 Oct 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #106 fixes PHP 7.4 compatibility.
-
2.4.119 Nov 2018Release notes
Open source →Added
- Nothing.
Changed
- #69 adds support for special pre/post characters in formats passed to the
DateTimeFormatterStrategy. When used, theDateTimeinstances created
during hydration will (generally) omit the time element, allowing for more
accurate comparisons.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Release notes
Open source →Added
- Nothing.
Changed
- #69 adds support for special pre/post characters in formats passed to the
DateTimeFormatterStrategy. When used, theDateTimeinstances created during hydration will (generally) omit the time element, allowing for more accurate comparisons.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
2.4.030 Apr 2018Release notes
Open source →Added
- #70 updates the
DateTimeFormatterStrategyto work with anyDateTimeInterface,
and not justDateTime.
Changed
- #75 ensures continuous integration requires PHP 7.2 tests to pass;
they already were.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Release notes
Open source →Added
- #70 updates the
DateTimeFormatterStrategyto work with anyDateTimeInterface, and not justDateTime.
Changed
- #75 ensures continuous integration requires PHP 7.2 tests to pass; they already were.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
- #70 updates the
-
2.3.102 Oct 2017Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #67 fixes an issue in the
ArraySerializable::hydrate()logic whereby nested array data was merged instead of replaced during hydration. The hydrator now correctly replaces such data.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #67 fixes an issue
in the
ArraySerializable::hydrate()logic whereby nested array data was merged instead of replaced during hydration. The hydrator now correctly replaces such data.
-
2.3.020 Sep 2017Release notes
Open source →Added
-
#27 adds the interface
Zend\Hydrator\HydratorProviderInterfacefor use with the zend-modulemanagerServiceListenerimplementation, and updates theHydratorManagerdefinition for theServiceListenerto typehint on this new interface instead of the one provided in zend-modulemanager.Users implementing the zend-modulemanager
Zend\ModuleManger\Feature\HydratorProviderInterfacewill be unaffected, as the method it defines,getHydratorConfig(), will still be identified and used to inject heHydratorPluginManager. However, we recommend updating yourModuleclasses to use the new interface instead. -
#44 adds
Zend\Hydrator\Strategy\CollectionStrategy. This class allows you to provide a single hydrator to use with an array of objects or data that represent the same type.From the patch, if the "users" property of an object you will hydrate is expected to be an array of items of a type
User, you could do the following:$hydrator->addStrategy('users', new CollectionStrategy( new ReflectionHydrator(), User::class ));
-
#63 adds support for PHP 7.2.
Changed
- #44 updates the
ClassMethodshydrator to add a second, optional, boolean argument to the constructor,$methodExistsCheck, and a related methodsetMethodExistsCheck(). These allow you to specify a flag indicating whether or not the name of a property must directly map to a defined method, versus one that may be called via__call(). The default value of the flag isfalse, which retains the previous behavior of not checking if the method is defined. Set the flag totrueto make the check more strict.
Deprecated
- Nothing.
Removed
- #63 removes support for HHVM.
Fixed
- Nothing.
Release notes
Open source →Added
-
#27 adds the interface
Zend\Hydrator\HydratorProviderInterfacefor use with the zend-modulemanagerServiceListenerimplementation, and updates theHydratorManagerdefinition for theServiceListenerto typehint on this new interface instead of the one provided in zend-modulemanager.Users implementing the zend-modulemanager
Zend\ModuleManger\Feature\HydratorProviderInterfacewill be unaffected, as the method it defines,getHydratorConfig(), will still be identified and used to inject heHydratorPluginManager. However, we recommend updating yourModuleclasses to use the new interface instead. -
#44 adds
Zend\Hydrator\Strategy\CollectionStrategy. This class allows you to provide a single hydrator to use with an array of objects or data that represent the same type.From the patch, if the "users" property of an object you will hydrate is expected to be an array of items of a type
User, you could do the following:$hydrator->addStrategy('users', new CollectionStrategy( new ReflectionHydrator(), User::class )); -
#63 adds support for PHP 7.2.
Changed
- #44 updates the
ClassMethodshydrator to add a second, optional, boolean argument to the constructor,$methodExistsCheck, and a related methodsetMethodExistsCheck(). These allow you to specify a flag indicating whether or not the name of a property must directly map to a defined method, versus one that may be called via__call(). The default value of the flag isfalse, which retains the previous behavior of not checking if the method is defined. Set the flag totrueto make the check more strict.
Deprecated
- Nothing.
Removed
- #63 removes support for HHVM.
Fixed
- Nothing.
-
-
2.2.320 Sep 2017Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #65 fixes the hydration behavior of the
ArraySerializablehydrator when usingexchangeArray(). Previously, the method would clear any existing values from the instance, which is problematic when a partial update is provided as values not in the update would disappear. The class now pulls the original values, and recursively merges the replacement with those values.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #65 fixes the
hydration behavior of the
ArraySerializablehydrator when usingexchangeArray(). Previously, the method would clear any existing values from the instance, which is problematic when a partial update is provided as values not in the update would disappear. The class now pulls the original values, and recursively merges the replacement with those values.
-
2.2.217 May 2017Release notes
Open source →Added
- Nothing
Changes
- #42 updates the
ConfigProvider::getDependencies()method to map theHydratorPluginManagerclass to theHydratorPluginManagerFactoryclass, and make theHydratorManagerservice an alias to the fully-qualifiedHydratorPluginManagerclass. - #45 changes the
ClassMethodshydrator to take into account naming strategies when present, making it act consistently with the other hydrators.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #59 fixes how the
HydratorPluginManagerFactoryfactory initializes the plugin manager instance, ensuring it is injecting the relevant configuration from theconfigservice and thus seeding it with configured hydrator services. This means that thehydratorsconfiguration will now be honored in non-zend-mvc contexts.
Release notes
Open source →Added
Changes
- #42 updates the
ConfigProvider::getDependencies()method to map theHydratorPluginManagerclass to theHydratorPluginManagerFactoryclass, and make theHydratorManagerservice an alias to the fully-qualifiedHydratorPluginManagerclass. - #45 changes the
ClassMethodshydrator to take into account naming strategies when present, making it act consistently with the other hydrators.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #59 fixes how the
HydratorPluginManagerFactoryfactory initializes the plugin manager instance, ensuring it is injecting the relevant configuration from theconfigservice and thus seeding it with configured hydrator services. This means that thehydratorsconfiguration will now be honored in non-zend-mvc contexts.
-
2.2.118 Apr 2016Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #28 fixes the
Module::init()method to properly receive aModuleManagerinstance, and not expect aModuleEvent.
-
2.2.006 Apr 2016Release notes
Open source →Added
- #26 exposes the
package as a ZF component and/or generic configuration provider, by adding the
following:
HydratorPluginManagerFactory, which can be consumed by container-interop / zend-servicemanager to create and return aHydratorPluginManagerinstance.ConfigProvider, which maps the serviceHydratorManagerto the above factory.Module, which does the same asConfigProvider, but specifically for zend-mvc applications. It also provices a specification toZend\ModuleManager\Listener\ServiceListenerto allow modules to provide hydrator configuration.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
- #26 exposes the
package as a ZF component and/or generic configuration provider, by adding the
following:
-
2.1.018 Feb 2016Release notes
Open source →Added
- #20 imports the documentation from zend-stdlib, publishes it to https://zendframework.github.io/zend-hydrator/, and automates building and publishing the documentation.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
2.0.017 Sep 2015Release notes
Open source →Added
- The following classes were marked
final(per their original implementation in zend-stdlib):Zend\Hydrator\NamingStrategy\IdentityNamingStrategyZend\Hydrator\NamingStrategy\ArrayMapNamingStrategyZend\Hydrator\NamingStrategy\CompositeNamingStrategyZend\Hydrator\Strategy\ExplodeStrategyZend\Hydrator\Strategy\StrategyChainZend\Hydrator\Strategy\DateTimeFormatterStrategyZend\Hydrator\Strategy\BooleanStrategy
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
- The following classes were marked
-
1.1.018 Feb 2016Nothing published for this version
-
1.0.017 Sep 2015Release notes
Open source →Initial release. This ports all hydrator classes and functionality from zend-stdlib to a standalone repository. All final keywords are removed, to allow a deprecation cycle in the zend-stdlib component.
Please note: the following classes will be marked as
finalfor a version 2.0.0 release to immediately follow 1.0.0:Zend\Hydrator\NamingStrategy\IdentityNamingStrategyZend\Hydrator\NamingStrategy\ArrayMapNamingStrategyZend\Hydrator\NamingStrategy\CompositeNamingStrategyZend\Hydrator\Strategy\ExplodeStrategyZend\Hydrator\Strategy\StrategyChainZend\Hydrator\Strategy\DateTimeFormatterStrategyZend\Hydrator\Strategy\BooleanStrategy
As such, you should not extend them.
Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.