Download the PHP package makinacorpus/goat-hydrator without Composer
On this page you can find all versions of the php package makinacorpus/goat-hydrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download makinacorpus/goat-hydrator
More information about makinacorpus/goat-hydrator
Files in makinacorpus/goat-hydrator
Package goat-hydrator
Short Description Advanced configurable flat and hierarchical object hydrator
License GPL-2.0-or-later
Homepage http://github.com/makinacorpus/php-hydrator
Informations about the package goat-hydrator
Goat hierachical hydrator
Advanced object hydrator based upon https://github.com/Ocramius/GeneratedHydrator supporting nested object hydration.
Optionnaly Ocramius/GeneratedHydrator can be seamlessly replaced by https://github.com/makinacorpus/generated-hydrator for PHP 5.6 compatibility.
This package provides a Symfony 3.4 and 4.x compatible bundle.
Status
Time has passed, and PHP 5.6 is not supported anywhere anymore, as a consequence this package is not supported anymore.
Please use makinacorpus/generated-hydrator-bundle insetad.
This package may if necessary receive some updates, for bugfixes and security fixes.
Get started
For efficiently hydrating objects, it may benefit from an offline preparation phase that introspects target object classes for later hydration. Using Symfony this preparation phase is done while compiling the container.
Test case scenario
Along this documentation, we will work on this scenario, we have three classes defined as such:
Standalone
Configuration
Simple configuration exemple, more documentation will come later:
Usage
Usage is trivial:
And now, calling print $a->getB()->getBar() . $a->getB()->getC()->getFoo();
should display Hello, World !
;
Symfony
Configuration
Add the bundle in your bundles.php
file (there is no flex recipe yet):
Use the goat_hydrator
configuration key:
Usage
Usage is the same as above, but for convenience you can inject the HydratorMap class into your controllers or services.
Behavior
Each time you call HydratorMap::get()
a new instance will be generated: if you
iterate over, for example, an SQL result set, always use the same instance: there
is caching happening each instance making it faster.