ZF2-279: RestfulController does not work with automatic template injection
Execute() method in https://github.com/zendframework/zf2/… checks for 'action' parameter in RouteMatch and if it's not present, goes on to automatically determine the method [of the Controller] to be called based on the HTTP verb (get/post/put/delete) of the user request.
The problem is, after determining the correct action (method to be called), that action name is not stored anywhere. So the injectTemplate() method in https://github.com/zendframework/zf2/… goes on to use only the Controller's name for setting the template name (just 'index' instead of 'index/get' or 'index/create' or 'index/update' and so on). This is not the desired behavior.
RestfulController should set a RouteMatch action parameter based on the action taken (Controller method called), so that the template injection mechanism would try to use the template name expected. Alternatively, a differently named parameter could be set (say, '_action') to differentiate for when the action is set by the router and when it's set by the controller (or anywhere outside the router), but this would require changes to \Mvc\View\TemplateInjection.php and I currently consider this approach to be too cumbersome and unnecessary.