I have following routes defined in Phalcon:
$router->add('/products', array(
'module' => 'products',
'namespace'=>'MyNameSpace\Products\Controllers\\',
'controller'=>'index',
'action' => 'index'
));
$router->add('/products/:params', array(
'module' => 'products',
'namespace'=>'MyNameSpace\Products\Controllers\\',
'controller'=>'index',
'action' => 'index',
'params' => 1
));
$router->add('/products/:action', array(
'module' => 'products',
'namespace'=>'MyNameSpace\Products\Controllers\\',
'controller'=>'index',
'action' => 1
));
$router->add('/products/:action/:params', array(
'module' => 'products',
'namespace'=>'MyNameSpace\Products\Controllers\\',
'controller'=>'index',
'action' => 1,
'params' => 2
));
And I have urls in following format
http://www.example.com/products/3029-baggrys-oats-2-kg-pack
=> Product detail page, here "3029-baggrys-oats-2-kg-pack" is a parameter
http://www.example.com/products/save-to-wish-list => Here "save-to-wish-list" is action to the controller
Problem The first url is intended to link to product detail page, second url is intended to let user save product to wish list.
But both url matches third route. I know I must be doing something wrong while defining routes. Can anybody point out what will be the better way to tackle this scenario ??
Thanks