-
Notifications
You must be signed in to change notification settings - Fork 8
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
Route parameters passed to controller methods. #244
Comments
Where do you want to use ReflectionParameter? I don't get it. |
FrontController could lookup Controller's method's parameters' names, and assign them proper keys from So this could work Route::get('/integration/:name', 'controller#byName'); public function byName($name) {
$this->integration = Integration::findByName($name);
} but this, would not: public function byName($something) { // <-- exception, there's no such thing as $this->params['something']
$this->integration = Integration::findByName($something);
} |
For the second option to work you'd have to design routes like this Route::get('/integration/:something', 'controller#byName'); |
We could just use order of arguments, so no ReflectionParameter would be needed. |
👍 for @bbankowski solution. Using order of arguments should have better performance. (Laravel uses this the way you described it 😄) |
Routes
Controller
instead of this
These parameters will always be present because routes would not point to those methods otherwise.
ReflectionParameter could be used to determine parameter name and assign proper param value.
The text was updated successfully, but these errors were encountered: