Skip to content

Clarify usage of delete() on a versioned record #878

@GuySartorelli

Description

@GuySartorelli

The Unpublishing and archiving a versioned DataObject section of the versioning docs says this:

Call doUnpublish() to unpublish an item. Either call doArchive() or simply call delete() to archive an item.

This strongly implies calling delete() will always automatically archive an item, but that's incorrect! That only works when calling the method on a draft record which has no published version.

Specifically, delete() deletes the record in the current stage. So if you're in the draft stage, you will remove the draft version (which may result in an orphaned live record). If you're in the live stage, you effectively unpublish the record.
Calling delete() directly might create weird version records though, so its use should probably be discouraged on versioned records, in favour of the appropriate method from the Versioned extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions