Heya, So I have this test route with a parameter that I would like to be optional..
test:
pattern: /test/:url
defaults:
_bundle: TestBundle
_controller: Test
_action: test
url: foo
There are several problems. First of all, if you set a value like in
this case foo, it works but only when calling /test, and it fails on
/test/. This is a general issue no matter whether you got optional stuff
or not, I think trailing slash shouldn't screw up the route, or at least
it'd be nice to have a setting for that, because for example if I use
the "Go to parent folder" in Opera it goes from /foo/bar/ to /foo/ with
a trailing slash, so I'd like to support such behavior.
Second, if you want url to default to null, it doesn't seem possible. I
tried with url: '' and url: null, both make it fail when I call /test.
This is an absolute requirement in my opinion.
Also I was wondering, since you seem to use reflection to order the
parameters when calling the controller, couldn't we just define default
values in the controller function declaration instead of having to
define them in the routing yaml? It sounds better for comprehension of
the code when you look at the controller, but that might be just me.
Cheers,
Jordi
signature.asc
Description: OpenPGP digital signature
