For example, if I have the following block of code in my config file:

$routes['webservice'] = new Zend_Controller_Router_Route(
    'web-service/timeline/:response/:user/:count/:callback/*',
    array(
        'response'   => 'json',
        'user'       => null,
        'count'      => 10,
        'callback'   => 'callback',
    )
);

URI: http://example/web-service/timeline/value/value/value/value

Everything works fine, and I can get the value of "user" using
$this->_getParam('user'). Now, if I add validation regex to that specific
route, then all the values get messed up and converted to key/value pairs.
For example:

$routes['webservice'] = new Zend_Controller_Router_Route(
    'web-service/timeline/:response/:user/:count/:callback/*',
    array(
        'response'   => 'json',
        'user'       => null,
        'count'      => 10,
        'callback'   => 'callback',
    ),
    array(
        'count'      => '\d+',
    )
);

Now, here the values are converted to key/value pairs:
http://example/web-service/timeline/key/value/key/value

This is something that shouldn't take more than a minute to setup, and today
I spent all day trying to understand the logic behind this, and I couldn't
figure it out.

There's no documentation about this. Does anyone know if this is a bug?


-- 
View this message in context: 
http://www.nabble.com/Adding-validation-to-a-route%2C-is-this-a-bug--tp21107494p21107494.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to