Skip to content
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

[3.2.x] Non-Identity Models Don't Save Snapshot on Creation/Save #13166

Closed
virgofx opened this issue Nov 17, 2017 · 3 comments
Closed

[3.2.x] Non-Identity Models Don't Save Snapshot on Creation/Save #13166

virgofx opened this issue Nov 17, 2017 · 3 comments
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@virgofx
Copy link
Contributor

virgofx commented Nov 17, 2017

When saving a new model that does NOT have an identity field (e.g. using a primary UUID instead) the snapshot does not get saved which results in errors when retrieving the updated fields.

$model = new NonIdentityModel();
$model->setKeys = 1;
$model->save();
$model->getChangedFields(); <--- Exception thrown because snapshot !== array

The Model::_doLowInsert() needs to move the snapshot save portion out of the identity-only block as snapshots are independent of whether the model has an autoincrement field or not.

image

@Jurigag
Copy link
Contributor

Jurigag commented Nov 20, 2017

Oh, good catch 👍

@Jurigag
Copy link
Contributor

Jurigag commented Dec 4, 2017

This can be closed as it is fixed already in 3.3.x

@virgofx
Copy link
Contributor Author

virgofx commented Dec 4, 2017

Closed /fixed in 3.3.x

@virgofx virgofx closed this as completed Dec 4, 2017
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants