Repository navigation
Conversation
|
Since we're not updating timestamps if |
|
To me it feels really, really silly to have this new property that we are setting to true / false at random times. I don't know, something about this all feels really hacky. |
|
Yeah it is a bit hacky but I don't have any other idea right now on how to fix it without breaking BC. Let me look at this a bit more tomorrow. Maybe I can find some better alternative. |
|
I mean just off the top of my head. What if something in a model updated event updates a different field on the model and does want the timestamps updated? |
|
As a reminder, That's a good example of what could happen when a test has to hook mocks into the implementation of what is being tested. |
|
@taylorotwell I found a better solution. I added a method User::withoutTimestamps()->update(['active' => 1]);@vlakoff Yeah mocking Eloquent is never a good idea. That's why I added a proper integration test for this issue. |
|
I don't even really want to support this at all. If you want to update a DB record without updating the timestamps use the query builder. This will lead to all kinds of more code to support weird edge cases where I want to not update the timestamps on the main model but I want to touch or not touch the parent models, etc. I don't even want to go down this rabbit hole. |
This fixes #10028 where timestamps are updated even if
['timestamps' => false]is passed to thesave()method.The easiest solution would be to simply pass the
$optionsarray to the update method on theBuilderbut since that would be a breaking change (someone may be extending the Builder) I added a new flag$shouldUpdateTimestampsthat is set tofalseif timestamps were disabled.