-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.8] Correctly modify updated_at on custom pivot model #29370
Conversation
@staudenmeir Would you review this PR? thanks |
/cc @ralphschindler |
Rerunning job |
Umm...
Still passed |
For me it's fixed, my test project is now working fine. |
@mpyw it's best that you thoroughly describe what this pr is fixing (as noted in the PR template) in your first comment instead of linking to an issue. |
@driesvints Updated |
Does this contain breaking changes? It looks like it could since you were forced to change an existing test. |
No, it doesn't contain breaking changes. I just reused the existing test. |
It's more like a new test, a behaviour is now tested, and previously it was not. Perhaps it's best to add a new test and don't modify the existing one, to ensure that the old test and the new test passes. |
Please create an entirely new test without touching any existing tests. You can resubmit this when that is done. |
I was so busy that I couldn't fix it in this PR. I'll resubmit this, thanks |
@mpyw no worries. Just sent in a new pr 👍 |
Hello, any news on this ? thanks. |
@driesvints Which branch should I newly target? |
@mpyw 6.x I believe |
This PR fixes #29321.
When we use default pivot,
updated_at
field is filled byInteractsWithPivotTable::addTimestampToAttachment()
and the UPDATE query is directly executed on Eloquent Builder.When we use custom pivot class, the behavior is quitely different.
updated_at
field is filled using Eloquent Model$timestamps
feature.AsPivot::hasTimestampAttributes()
dynamically determines$timestamps
whether attributes fromInteractsWithPivotTable::newPivot()
containscreated_at
field.However, there is always no
created_at
attribute on updating. So we must set$timestamps
after callingInteractsWithPivotTable::newPivot()
.