-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fixing model observers integration #74
Conversation
Could you add a test for this? |
Added the testcase |
Thanks! |
Please revert this change. Loading data from the database will now always have all the encrypted fields marked as dirty. $model->getDirty() will return them just after loading them from the database. It's because $model->getRawOriginal() now returns the encrypted data, instead of the decrypted one. I understand that it might be nice to be able to see the encrypted data in the model, but the model original data should contain the decrypted database data. My suggestion is to add a new method in the UseCipherSweet trait to get the encrypted data. Not good ! |
@yormy could you take a look at this? @felabrecque If you need a solution fast, I'm open for a PR that fixes this. |
It seems that ANY change to a record that has encrypted fields mark the fields as dirty, also in the master before my change. It might be a feature to re-encrypt everything on saving, i am not sure about that details of implementation. Can anyone comment ? |
Revert PR #74 and fix getChanges()
When using model observers saved feature, the old dirty flags were reset to nothing. So you were not able to retrieve any old or updated values.
Sometimes this is needed to do some action after saving a changed model