[5.4] Feature/Bug: Allow ImplicitRouteBinding to match camelized method parameter names#18307
Conversation
- allow ImplicitRouteBinding to match compound name ('foo_bar') route parameters to method/function naming ('fooBar')
0892287 to
6f7d60c
Compare
|
I agree this should be fixed. Will look this over, thanks. |
|
Thanks @taylorotwell. As I thought through the problem, this felt like the most appropriate area to solve the problem, to me at the time. Should you require any discussion on it, I am available inside #internals & #laravel5 in larachat. |
|
What do you mean by "Route::resource() doesn't allow for hinting a proper parameter name"? |
|
Not that someone should have been doing this, but this is broken now: No one is expecting a binding match when the parameter names aren't an exact match. Contrived example or not, what was allowed before and worked, doesn't now. I'm just a worrier :-). |
Problem:
will not route implicitly bound model parameters to
since ImplicitRouteBinding will not match the auto-generated
foo_barresource parameter name to the controller method name$fooBar.The provided PR ensures this will work in a non-breaking way (original explicit matching remains priority matching, and only in the case of non-matching exact will the snake_case version of a method name be attempted to be matched.
(I feel this could qualify as a bug since my expectation is that camelized method parameter naming should work and Route::resource() doesn't allow for hinting a proper parameter name.)