Three questions about Symfony 2 routes.

This route:

edit:
    pattern:  /admin/edit/:slug
    defaults:
      _controller: SillyCMSBundle:Page:edit
      requirements:
        slug: '/^.*$/'

Does not match this URL:

http://sillycms/app_dev.php/admin/edit/

I get "ERR No route found for /admin/edit/" with this URL.

If I visit:

http://sillycms/app_dev.php/admin/edit/foo

That works fine, and foo becomes the value of slug.

Is this supposed to work?

If not, how would I generate a path() to edit an item that might or
might not have the empty slug? Do I have to special-case it?

This being Symfony 2 and a chance for a clean slate, I'm looking to do
things right and avoid a lot of 'if silly case then foo, else bar'
blocks.

* * *

Is it possible to capture the leading / in a route parameter? That
would work around the above problem but I suspect it can't be done
since routes have to start with a /.

* * *

What if I want to use the query string to pass 'slug' in some routes,
but use a parameter in the URL in others? It would seem that the
action methods have to be conscious of this and look explicitly at
'request' instead of arguments passed to the method - there is no such
thing as just changing the route to go from using query string
parameters to using pretty URLs, as you could do in Symfony 1.x. Is
that correct?

Thanks!

-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
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 users" 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-users?hl=en

Reply via email to