I have a form that allows a user to change his password. The URL to the form is "backend_dev.php/user/1/changePassword". In order for it to work, I needed to add this route:
- Code: Select all
user_change_password:
url: /:module/:id/changePassword
class: sfDoctrineRoute
param: { module: user }
options: { model: User, type: object }
requirements:
id: \d+
In the form template, I created the form tag this way:
- Code: Select all
<?php echo form_tag_for($form, '@user_change_password', array('id'=>'form')) ?>
I created the following route, placed preceeding the user_change_password route:
- Code: Select all
user_change_password_update:
url: /:module/:id/updatePassword
class: sfDoctrineRoute
param: { module: user }
options: { model: User, type: object }
requirements:
id: \d+
In that case, the form action points correctly to "backend_dev.php/user/1/updatePassword"
When I submit the form, this error occurs: Action "user/1" does not exist.
By seeing the log, I found this entry:
Match route "default" (/:module/:action/*) for /user/1/updatePassword with parameters array ( 'module' => 'user', 'action' => '1', 'updatePassword' => true,)
The question is: why does the default route matchs instead of the user_change_password_update route?
Default route is the last route in the routing.yml file.
Any help will be greatly appreciated
Thanks
Jaime
