-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Dynamic updates / snapshot data work correctly only once #11424
Comments
anyone working on this? In our case it is really anoying to perform a new find every time you just want to update a previously saved model. |
So pretty much - save(if succesfull) should just update snapshot if needed ? |
$model = new Address();
$model->setCity('Munich');
if (!$model->save()) {
print_r($model->getMessages());
}
$model->setStreet('test');
if (!$model->save()) {
print_r($model->getMessages());
} => The record doesn't have a valid data snapshot |
@Jurigag Did your recent changes for the cache snapshot fix this? Or is it related? Maybe we can fix both for 3.0.3 real quick |
No, it's not related really, it's diffrent issue. I think that save method in model after successfull save should just update snapshot to current one which is not doing now ? |
I made PR with fix for this, let me know what you think. |
Fixed in the |
See: https://forum.phalconphp.com/discussion/10477/snapshot-data-not-updated-following-save-update-bug-limitation-u
When making a save() or update() to a model with snapshots in place, any subsequent changes and save/update to the model instance also include fields changed in prior updates but that have not changed since. It appears that snapshot data is not updated with the values applied during a save/update operation. This is inefficient and problematic if a prior update is not idempotent, such as using now().
It should be possible to make repeated change/update operations on a model and each time have only the changed fields updated as that is the purpose of the feature.
The text was updated successfully, but these errors were encountered: