Makes sense. I probably answered too fast.

--
Alejandro Celaya Alastrué
www.alejandrocelaya.com
El 30/3/2015 14:11, "Matthias Tylkowski" <[email protected]> escribió:

> I still need the id of the customer also in the other route, as I want to
> display the artifacts of that specific customer.
>
> As test I also added an id to the second route, which would look like
> this: */customer[/:id]/latest[/:artifactId]*
> I still the *:id* in the second controller.
>
> Since its a new Controller, it is also a new scope. I would expect to
> start a new controller with *getList()* as there is no *id *given for the
> current controller.
>
> Regards
> Matthias Tylkowski
>
> Am 30.03.2015 um 13:57 schrieb Alejandro Celaya:
>
>> 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