Note that there are some explanatory texts on larger screens.

plurals
  1. PODeep routes in Zend Framework without modules - how?
    text
    copied!<p>I'm writing some routes for a REST service. One of my resource's URI looks like this</p> <p>resources/user/:id</p> <p>I also want to give access to individual attributes of a user, which would look like this</p> <p>resources/user/:id/:attribute</p> <p>But when I try to define that latter route, it doesn't work. Here's my ini where the routes are defined</p> <pre><code>routes.user.route = "resources/user/:id" routes.user.defaults.controller = user routes.user.defaults.action = get routes.user.defaults.id = 0 routes.user.reqs.id = "\d+" routes.user_attribute.route = "resources/user/:id/:attribute/" routes.user_attribute.defaults.controller = user routes.user_attribute.defaults.action = getAttribute routes.user_attribute.defaults.id = 0 routes.user_attribute.defaults.attribute = "" routes.user_attribute.reqs.id = "\d+" routes.user_attribute.reqs.id = "reviews|lists" </code></pre> <p>When I try to access resources/user/4/reviews in my browser, I get the following output</p> <pre><code>An error occurred Page not found Exception information: Message: Invalid controller specified (resources) Stack trace: #0 /usr/local/lib/ZendFramework/ZendFramework-1.7.1-minimal/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/baileyp/public_html/web/index.php(50): Zend_Controller_Front-&gt;dispatch() #2 {main} Request Parameters: array(4) { ["controller"]=&gt; string(9) "resources" ["action"]=&gt; string(4) "user" [10]=&gt; string(7) "reviews" ["module"]=&gt; string(7) "default" } </code></pre> <p>So, it's clearly not processing my 2nd route correctly, since it things the controller is "resources" and the action is "user". What am I doing wrong here? There's no examples on the Zend site that I've found that illustrate how to implement this.</p> <p>And I don't want to use modules just to get this done - avoiding the creation of folders and such just to match a URI is the entire purpose of a routing system.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload