Abstract restful controller

Ok, so here is how I see it :

1. The onDispatch extract the method and tries to see if it exists (this means that we don't have an interface like in ZF 2 AbstractRestfulController where users have to implement all methods). People just implement the method they want to expose. This also means that no action other than standard HTTP verbs can be done (for instance AbstractRestfulController of ZF 2 allow to fallback to standard action). Question about this : how can we dissociate between get/getList ? Once again the lack of overloading is annoying :'(.

2. The controller fetch the resource (because it already has been loaded by the persistence layer in the router, and set as a param of MvcEvent with key "resource"), and call the method with the Resource. I cannot really see where your specific Request object comes in this workflow as it's not clear to me what's inside.

3. Catch the return result (an array or a ModelInterface), and we return it.

4. End of controller.

So here the controller to my understanding is veeerry simple. It just delegates the work the method if it exists. Fetching the resource is done before.

For converting the content to a format compatible to the Content-Type request, this can be done in the "render" event I suppose, using a custom RenderingStrategy. Of course, we may verify before doing all this in the controller that the content-type match.