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

FIX: Track deletions correctly #34

Merged
merged 1 commit into from
Oct 12, 2020
Merged

FIX: Track deletions correctly #34

merged 1 commit into from
Oct 12, 2020

Conversation

sminnee
Copy link
Member

@sminnee sminnee commented Jul 6, 2020

Because $obj->ID is set to 0 on a deleted record, this broke the existing
snapshot creation.

Relies on silverstripe/silverstripe-versioned#280,
without which deletions are logged as another creation.

Fixes #33

if (!$record) {
return null;
}
if ($record->hasExtension(Versioned::class) && $record->isArchived()) {

$refetched = DataObject::get_by_id($record->baseClass(), $record->ID);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why we need to re-fetch the record here, and can't simply return the existing record in all cases.

@sminnee sminnee mentioned this pull request Jul 6, 2020
@sminnee sminnee closed this Oct 7, 2020
@sminnee sminnee reopened this Oct 7, 2020
@sminnee
Copy link
Member Author

sminnee commented Oct 7, 2020

@unclecheese would be good to get this reviewed if you have chance.

Because $obj->ID is set to 0 on a deleted record, this broke the existing
snapshot creation.

Relies on silverstripe/silverstripe-versioned#280,
without which deletions are logged as another creation.
@unclecheese
Copy link

LGTM

@unclecheese unclecheese merged commit ff53a35 into silverstripe:master Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deletions not snapshotted
2 participants