zf-fr/ZfrRest — pull request #39 by bakura10 (2013-05-10 12:59:33+00:00)
Title: [WIP] Hydrator and resource serialization

I want to do correctly the hydration stuff, both for extraction and hydration.

Here are the features that we need to implement properly:

1. Allow to support kind of "naming scheme". This naming scheme is used for extraction (when the user return an object from a controller) and hydration (when data is sent from the client to the server). Those naming scheme defined how the JSON (question: what about XML? as of today ZF has no support for XML, so maybe it's simpler if we only support JSON) is formed. Following things must be taken into account : what is the style of keys (underscore_separated, camelCased...), should the resource be wrapped around a key, how associations are done (embedded, id...).
2. Being able to hydrate/extract data that is wrapped around paginator, collection... For instance, we may have a Paginator in the controller, we should be able to hydrate/extract it, so that it automatically outputs data specific to the paginator and data specific to the resource. This may be a use for the new AggregateHydrator.

At some point, those objects would use the resource metadata that contains various information from mapping (for instance how a given association should be represented). So we most likely have a custom Paginator class that extends Zend\Paginator and hold metadata or something like that.

@Ocramius , is this something you could work on ? I'd be happy to update the current doc to reflect my latest changes so that you can use it more quickly.