25th/apigility-serializing-hydrator

There is no license information available for the latest version (dev-master) of this package.

dev-master 2014-11-02 14:58 UTC

This package is not auto-updated.

Last update: 2024-11-09 15:34:12 UTC


README

Add the following to your module.config.php:

'invokables' => [
	'TwentyFifth\Hydrator\SerializingHydrator' => 'TwentyFifth\Hydrator\SerializingHydrator',
],
'initializers' => [
	function ($instance, ServiceManager $sm) {
		if ($instance instanceof \Zend\Stdlib\Hydrator\HydratorPluginManager) {
			$instance->setInvokableClass('SerializingHydrator', 'TwentyFifth\Hydrator\SerializingHydrator');
		}
	}
],

Then you can either set the hydrator as default:

'zf-hal' => [
	'renderer' => [
		'default_hydrator' => 'SerializingHydrator',
	],
]

Or you can specify it directly in one resource:

'zf-hal' => [
	'metadata_map' => [
		'Your\\Project\\Foo' => [
			'identifier_name' => 'id',
			'route_name'      => 'api/foo',
			'hydrator'        => 'SerializingHydrator',
		]
	]
]