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

Comments

Projects
None yet
3 participants
@virgofx
Member

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

This comment has been minimized.

Show comment
Hide comment
@Jurigag

Jurigag Nov 20, 2017

Member

Oh, good catch 👍

Member

Jurigag commented Nov 20, 2017

Oh, good catch 👍

@Jurigag

This comment has been minimized.

Show comment
Hide comment
@Jurigag

Jurigag Dec 4, 2017

Member

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

Member

Jurigag commented Dec 4, 2017

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

@virgofx

This comment has been minimized.

Show comment
Hide comment
@virgofx

virgofx Dec 4, 2017

Member

Closed /fixed in 3.3.x

Member

virgofx commented Dec 4, 2017

Closed /fixed in 3.3.x

@virgofx virgofx closed this Dec 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment