Closed K-Phoen closed 9 years ago
Smart. Great PR!
How to deal with arrays? What if we append an array? We should build query strings like foo[]=…&foo[]=…
. Does it work?
@K-Phoen That's a good idea but I was thinking: What if we change the route and an undefined variable is now a defined one. Is it dangerous? What is the impact of such a modification? /cc @osaris
I didn't test but I think that query strings like foo[]=…&foo[]=…
should work as http_build_query
is supposed to handle multi-dimensional arrays.
For your second concern, I don't think that the impact is dangerous as the previously undefined variable will disappear from the query string to be embedded directly in the URL.
This would look like this: /blog/posts?page=1
becomes /blog/posts/page/1
.
@K-Phoen Correct.
Well, sounds excellent for me! Waiting for the review of @osaris :smiley:.
The behaviour for variables becoming defined/undefined is what I expected and it make sense from user (of the lib) point of view. The patch is good to merge from my point of view ! Thanks @K-Phoen
@osaris :+1:
To keep it short, this goal of this PR is to mimic Symfony's routing component behaviour regarding routes generation.
As explained in their documentation, when generating a URL from a route extra parameters are added to the URI as query string.