Urlmanager Problem


I have this setup in the config file:





                  //RESTful :

                  array('<controller>/add', 'pattern' => 'api/v1/<controller:\w+>', 'verb'=>'POST'),

                  array('<controller>/edit', 'pattern' => 'api/v1/<controller:\w+>/<id:\d+>', 'verb'=>'PUT'),

                  array('<controller>/view', 'pattern' => 'api/v1/<controller:\w+>/<id:\d+>', 'verb'=>'GET'), 

                  array('<controller>/archive', 'pattern' => 'api/v1/<controller:\w+>/<id:\d+>', 'verb'=>'DELETE'),

                  array('<controller>/list', 'pattern' => 'api/v1/<controller:\w+>', 'verb'=>'GET'),

                  //Other :

                  '<controller:\w+>/<id:\d+>' => '<controller>/view',

                  '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                  '<controller:\w+>/<action:\w+>' => '<controller>/<action>',



and it works great (when I’m trying to go to /api/v1/controller/x whith PUT Or DELETE it works),

The problem occurs when I want to create a normal link to ‘controller/edit’ it recreating the link to ‘api/v1/controller/x’ but because it is a link it will be with a GET method.

How can I use the ‘controller/edit’ directly?

OR [color="#FF0000"](and I prefer doing this–>)[/color]

How to tell the url Manager that when I have a parameter ‘?method=PUT’ to use the ‘controller/edit’ Action?

can I add a rule like that?

array('<controller>/edit', 'pattern' => 'api/v1/<controller:\w+>/<id:\d+><method:PUT>', 'verb'=>'GET')

(I know this doesn’t work but maybe there is something similar…)


array('<controller>/edit', 'pattern' => 'api/v1/<controller:\w+>/<id:\d+>', 'matchValue' => true, 'defaultParams' => array('method' => 'PUT'), 'verb'=>'GET'),

but maybe you could suggest a better solution?

since I read this is not optimal …