Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend: What is the most common way to create Rest Zend routes?

I'm using default Zend_Rest_Route to generate Rest routes:

So given I just put resources.router.routes.rest.type = Zend_Rest_Route inside application.ini and now have Rest Routes for users

GET users
POST users
GET users/:id        
GET users/:id/edit   
PUT users/:id
DELETE users/:id

But how about nested resources? Given I need

users/:user_id/articles
users/:user_id/articles/:id
... etc

Is there any way to keep routes REST'y? Will appreciate any example of creating such nested routes

P.S. I'm using ZF version 1.10.8

Regards, M

like image 956
fantactuka Avatar asked Nov 05 '22 06:11

fantactuka


1 Answers

I may be late here, but i want to answer your question.

As mentioned here, the creation of rest route configuration in application.ini may not work.

Coming to your point of the route configurations, you can use Zend_Controller_Router_Route_Regex for defining routes and corresponding mappings. Refer this question of myne. Might help you.

like image 80
shasi kanth Avatar answered Nov 10 '22 21:11

shasi kanth