Odd isDirty() wasChanged() results in post-save hooks #40182
Unanswered
peanutsmcgee
asked this question in
Q&A
Replies: 3 comments
-
I am facing same issues on live environment, I am using these methods inside a job, executed by horizon at live, but it works wrongly. Only at local environment when we run job via queue work, it works find. Not sure, what can be the issue but couldn't find any proper answer for this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Put up a PR for this. #47325 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@peanutsmcgee the PR was rejected as a BC. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've noticed some odd behavior with
isDirty
andwasChanged
when used within a post-save event hook such assaved
updated
andcreated
. Both are evaluating to true, but shouldn't theisDirty
be false?This is the code I tested it with:
Output:
The way I understand things,
isDirty
is to be used before a model is saved, andwasChanged
is to be used after a model is saved. Wouldn't this example be considered "after the model was saved"? Is this a bug, or are these post-save hooks supposed to act this way?Beta Was this translation helpful? Give feedback.
All reactions