Looking through the Symfony documentation, I found a way to secure a form with a “token” field. I’m trying to implement that and the form generates a token but it doesn’t pass it in the URL to the “showSuccess.php” page so it’s now displaying my _admin.php partial.
I thought it had to do with the routing but I have the routing the same as they do and it still doesn’t work.
car:
class: sfDoctrineRouteCollection
options: { model: car, column: token }
requirements: { token: \w+ }
car_show:
url: /car/:iditem.:sf_format
class: sfDoctrineRoute
options: { model: car, type: object }
param: { module: car, action: show, sf_format: html }
requirements: { iditem: \d+, sf_method: get }
Now the form itself requires the token field in the URL, but when I submit the form it’s supposed to pass a “tokenized URL” to the success page so that a partial can be displayed, but the URL defaults to the “iditem” field instead of the “token” field so my partial doesn’t render.
I found that if I change the name of the second route to something else (or delete it), then the tokenized URLs work. But then the regular URL doesn’t.
Is this something I need to change in the class files?
Here is my reference. Symfony Documentation
I actually figured it out. The “sfDoctrineCollection” for the first set of routes was creating a “car_show” route so the one that I put in there was overwriting it. All I did was change the name of the second route to something different and it worked.
I just had to update all references to the old route in all of my links.