zendframework/zf2 — pull request #6894 by ojhaujjwal (2014-11-18 14:57:00+00:00)
Title: standard hydrator idea

I created this hydrator and named it as `StandardHydrator`. This is just an idea. This name can be changed if you guys like the idea.

```php
class Album
{
public function getId()
{
return 34;
}
}

class Artist
{
public function getName()
{
return 'David';
}
}

$albumHydrator = new Zend\Stdlib\Hydrator\ClassMethods;
$artistHydrator = new Zend\Stdlib\Hydrator\ClassMethods;

$hydrators = new Zend\Stdlib\Hydrator\HydratorPluginManager;
$hydrators->setService('Album', $albumHydrator);
$hydrators->setService('Artist', $artistHydrator);

$standardHydrator = new Zend\Stdlib\Hydrator\StandardHydrator($hydrators);

$standardHydrator->extract(new Album); // returns ['id' => 34];
$standardHydrator->extract(new Artist); // returns ['name' => 'David'];
```

This detects the hydrator for each object. I think that this hydrator can be pretty useful.