-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
Possible Bug with Touching Parent Timestamps #17867
Comments
I remember in some version upgrade guide (5.3 or 5.4) there was a note that |
Alternatively, we could perform Anyway, I think this is a bug:
There is a clear inconsistency here. |
Its there are any fix for that problem? |
A fix was submitted in: #20489 |
Description:
'Touches' updates touched models updated_at timestamp when child model performs an update with no dirty data (thus no updated_at change on child model).
Steps To Reproduce:
Using the example from the docs:
https://laravel.com/docs/5.4/eloquent-relationships#touching-parent-timestamps
Performing an update with no dirty data on the 'comment' model would result in the 'post' model's updated_at timestamp being updated, while the 'comment' model does not (due to it not being dirty).
Is this expected behaviour or a bug? Happy to put in a PR to fix, it's in the snippet below where the $saved = isDirty... ternary sets $saved to true when the data on the model isn't dirty... and thus finishSave() gets called which updates parent timestamps.
The text was updated successfully, but these errors were encountered: