-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[6.x] Fixes #31124 #31125
[6.x] Fixes #31124 #31125
Conversation
Heya, can you please provide an explanation what this fixes instead of linking to an issue? Also please add a test that proves any bug gets fixed. |
@GrahamCampbell , @taylorotwell please kindly review this, and merge as soon as possible. This is a blocker for my project, so a fast release would be great. |
@driesvints , done with description. Good enough? :) |
@shehi we'll need a test as well. |
@driesvints , I think you already have a test, it just ran with "pivot" attribute name, instead of some customized one. If this isn't the right test, please point me in right direction - tests there are too "messy" for my small brain. |
@shehi the fact that nothing breaks with these changes is an indication that this isn't tested. We'll need a test close to that one I suspect. |
I won't be able to create that test. Don't really have time at this point in time. Please close this one if it can't continue, I will just rename my stuff to "pivot". |
@taylorotwell , @driesvints , I know it wasn't quite "ethical" to force you guys into merging it like this, I really don't have time right now for test writing. Please accept my apologies. |
$this->load(collect($this->relations)->except('pivot')->keys()->toArray()); | ||
$actualRelations = collect(); | ||
foreach ($this->relations as $key => $relation) { | ||
if (! ($relation instanceof Pivot)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work with AsPivot
trait...
This fixes the bug where pivot attribute name is customized. When customized, that attribute isn't "pivot" anymore (and doesn't get filtered out), and as a result of it remaining in the list of relationships to be loaded during
refresh()
, model attempts to load these pivots as actual relationships, and this naturally fails.Fixes #31124