php - Zend Framework 2 RestfulController with additional actions -
i utilize abstractrestfulcontroller controller in zf2-application. controller implements create(), update() etc.
is possible have actions next rest-functions?
e.g. want have: url.com/model/id model (this works already), want able phone call url.com/model/dosomething well.
i tried using child_routes, did not work:
'car' => array( 'type' => 'literal', 'options' => array( 'route' => '/car', 'defaults' => array( 'controller' => 'cardealer\controller\car', 'action' => 'index' ), ), 'child_routes' => array( 'rest' => array( 'type' => 'segment', 'options' => array( 'route' => '[/:id]', 'constraints' => array( 'id' => '[0-9]+', ), 'defaults' => array( 'controller' => 'cardealer\controller\car', ), ), ), 'actions' => array( 'type' => 'segment', 'options' => array( 'route' => '[/:action]', 'constraints' => array( 'action' => '[a-za-z][a-za-z0-9_-]*', 'id' => '[0-9]+', ), 'defaults' => array( 'controller' => 'cardealer\controller\car', 'action' => 'index', ), ), ), ), ),
i pretty sure above doesnt create much sense, not find right hints things working.
thanks help!
the abstractrestfulcontroller won't dispatch arbitrary action method, should utilize kid route , controller.
php rest zend-framework2
No comments:
Post a Comment