The second route is a child of /customer[/:id].
Instead make the parent route to be /customer with your current child and
another child with the /:id part.

--
Alejandro Celaya AlastruƩ
www.alejandrocelaya.com
El 30/3/2015 13:54, "tylkomat" <[email protected]> escribió:

> I have a nested Route which points to two different
> AbstractRestfulControllers:
>
> 'router' => array(
>     'routes' => array(
>         'api' => array(
>             'type' => 'Zend\Mvc\Router\Http\Literal',
>             'options' => array(
>                 'route' => '/api',
>             ),
>             'may_terminate' => false,
>             'child_routes' => array(
>                 'restCustomer' => array(
>                     'type' => 'Zend\Mvc\Router\Http\Segment',
>                     'options' => array(
>                         'route' => '/customer[/:id]',
>                         'defaults' => array(
>                             'controller' => 'restCustomer',
>                         ),
>                         'constraints' => array(
>                             'id' =>
> '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
>                         ),
>                     ),
>                     'may_terminate' => true,
>                     'child_routes' => array(
>                         'latestArtifacts' => array(
>                             'type' => 'Zend\Mvc\Router\Http\Literal',
>                             'options' => array(
>                                 'route' => '/latest',
>                                 'defaults' => array(
>                                     'controller' =>
> 'restCustomerLatestArtifacts',
>                                 ),
>                             ),
>                             'may_terminate' => true,
>                         ),
>                     ),
>                 ),
>             ),
>         );
>     ),
> ),
>
> For the restCustomer route everything works as expected. */customer* is
> mapped to *getList()* and */customer/:id* is mapped to *get($id)* function.
> For the second controller the request goes to the *get()* function with the
> *:id* of the other controller. I would expected this request to go to
> *getList()*.
>
> Should I file a bug or did I do something wrong?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Nesting-Routes-for-AbstractRestfulController-tp4662499.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to