I just thought about something similar. I think it would be greate if you
could pass an object instead of the parameter array to the router#generate()
method.
Here is my idea:
Given you have a route like this:
edit_user:
pattern: /user/{id}/edit
Note that id is a require parameter.
Now you could call:
$router->generate('edit_user', $user)
provided $user has a getId() Method or an $id property.
Then you could just change the url later on to eg. /user/{nickname}/edit (as
long as the user has a getNickname() method) without the need of changing
all the templates and controllers the url is used in.
In twig you would just use i like this:
{{ path('edit_user', user) }}
This kind of simple url generation is something I am missing in symfony2 as
a everyday rails developer.
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en