phpro/zf-doctrine-hydration-module — pull request #9 by boukeversteegh (2014-12-02 21:37:17+00:00)
Title: Added support for NamingStrategies.

This allows you to map entity propertynames to keys. Doctrine already supports this, but this module didn't.

For example:
```php
class User {
protected $id;
protected $userConnections;
}
```
mapping it to:

```json
{
"id": 12,
"connections": []
}
```

NamingStrategy class:
```php
namespace Application\Strategies;
use Zend\Stdlib\Hydrator\NamingStrategy\MapNamingStrategy;

class UserNamingStrategy extends MapNamingStrategy {
protected $mapping = [
'connections' => 'userConnections',
];

public function __construct() {
parent::__construct($this->mapping);
}
}
```

config file:
```php
return array(
'doctrine-hydrator' => array(
'user' => array(
'entity_class' => 'doctrine.entity',
'object_manager' => 'doctrine.entitymanager.orm_default',
'by_value' => true,
'naming_strategy' => 'Application\Strategies\UserNamingStrategy',
'strategies' => array(
'userConnections' => 'Application\Strategies\EmbeddedCollectionStrategy',
)
),
```