-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Model afterInsert return originals? #2045
Comments
Is this a feature request or a bug report? |
I think that's a question of intent. As a developer, the current behavior threw me off and I was unable to do what I expected with the event. But maybe that was my misunderstanding? It's hard to guess the scope of what model after insert events might need to do, but it makes more sense to me for the event to trigger with the inserted data rather than the submitted data. |
Makes sense. |
Hard to say! I know @lonnieezell has given Model some attention recently, if he has an opinion. Either way, if this seems at least partway plausible I can start a PR. Think it's okay to proceed? |
If this is indeed a BC, then I think it should wait. Let's see what Lonnie says. |
I think it's ok to proceed on this. When that portion of the model was originally created, there were a number of aspects with entities and the like that didn't exist yet, so things have been added on and looks like that was overlooked. But, yes, I believe it should be the data that was actually inserted. |
@MGatner Are you thinking of proceeding with this? Should it be removed from the rc.3 milestone? |
It's a small change, I've been swamped but I'll get it in shortly. |
Resolved with #2332 |
Right now model event
afterInsert
returns "the original key/value pairs being updated" - which is a little ambiguous, it actually means the values you passed intoinsert()
(including fields that didn't matchallowedFields
). While this info is somewhat useful, there is no way to determine what was changed, or even the original data (to perform a diff). I would like to see some way of passing either changed fields or the original fields.The text was updated successfully, but these errors were encountered: