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.
The Unpublishing and archiving a versioned DataObject section of the versioning docs says this:
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 theVersionedextension.