On 10 June 2014 23:21, Julian Vidal <[email protected]> wrote: > Methods that end in "Action" are supposed to be called automatically by the > framework, not by you directly.
To be fair, it's not even the framework. It's handled by `Zend\Mvc\Controller\AbstractActionController#onDispatch()`. Yes, you can't have parameters on actions when using the `AbstractActionController`. I like the idea of having parameters passed to controller actions, it is a concept that I always loved since I saw JAX-RS for java (no kidding! for those who don't know any J2EE: please go check it out!). In fact, I and Bakura (Michael Gallego) have even worked on an entire module that just enables this: https://github.com/zf-fr/zfr-rest What happens in that particular module is in fact: 1 - routing determines an "entity" or "collection" that represents the current REST resource 2 - the controller is resolved (like normally in a ZF2 Mvc app) 3 - the controller action is resolved (in this context, that depends on the HTTP verb being used) 4 - the resource is passed to the controller action, which has a signature like `public function patch(SomeEntity $entity) {...}` I think this greatly simplifies your controller logic, and I'd like to further extend these concepts to DTOs. If you find a good way of passing parameters to action controllers without being too opinionated, then please do share: I'd love to see more development in this direction. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/
