-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array parameter routing (idea) #38
Comments
@FrenkyNet Is this supported by fuelphp/routing ? |
@FrenkyNet ping? |
@WanWizard this isn't supported, I wouldn't know of any way to map this to an array though. 😕 |
Thought so. Possible option: there is already the possibility for named parameters, right. If would not be to difficult to implement that if a name occurs multiple times, it's stored in an array, so you can define Challenge is when, as Steve mentioned, the number of names is variable. Alteratively you could define the named parameter as an array like so: |
The idea is to be able to have a "match many" parameter when defining routes. This would allow the ability to pass any number of segments as an array to an action.
Example:
Define a route to match
controller/action/names/[]/foo/bar
where the[]
would be a place-holder marker that matches any number of segments until the one after it is matched (in this casefoo
).This would then be passed to the action like so:
$names
would then be an array populated with anything that is found between thenames
andfoo
segment, or an empty array if none where matched.A route such as
controller/action/names/tom/dick/harry/foo/bar
would pass the parameters below to the action.This could then also work with multiple array segments:
controller/action/names/[]/ages/[]
to pass multiple arrays to the action.The text was updated successfully, but these errors were encountered: