[5.6] Add reference to model in MassAssignmentException#23229
Merged
taylorotwell merged 2 commits intolaravel:5.6from Feb 22, 2018
Merged
[5.6] Add reference to model in MassAssignmentException#23229taylorotwell merged 2 commits intolaravel:5.6from
taylorotwell merged 2 commits intolaravel:5.6from
Conversation
ntzm
reviewed
Feb 20, 2018
| if ($this->isFillable($key)) { | ||
| $this->setAttribute($key, $value); | ||
| } elseif ($totallyGuarded) { | ||
| $model = get_class($this); |
Contributor
There was a problem hiding this comment.
You can use static::class instead, removes the overhead of a function call
Contributor
Author
There was a problem hiding this comment.
Ok thanks, updated!
Member
|
Check the stack trace. |
Contributor
Author
|
@taylorotwell Thanks for your answer. Still, there is no reference in these cases about the class in the stack trace: only references to |
Contributor
Author
|
Thanks for repopening. Style CI failed but I don't know why. Any idea @GrahamCampbell? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request and this commit updated mass assignment exception wording. I think we could improve it a bit more by giving the model class name.
So replacing:
By:
Errors on models are sometimes confusing, because there is no explicit reference to the actual model in backtrace. This PR could be a one step more to make errors more understandable in Laravel.