Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Versioned DataObjects not deleted from all Stages when DataObject->delete() is called


Go to End


3 Posts   672 Views

Avatar
nzphoenix

Community Member, 2 Posts

18 March 2016 at 12:03pm

Perhaps I'm missing something here, but the docs state:

/* Delete this data object.
* $this->onBeforeDelete() gets called.
* Note that in Versioned objects, both Stage and Live will be deleted.
* @uses DataExtension->augmentSQL()
*/
public function delete() {
..

However, on a versioned DataObject delete() is only removing from the base table and not _Live table.

The delete is being invoked by a GridFieldConfig_RecordEditor.

Are the docs incorrect here, do I need to do an onAfterDelete hook to ensure it's actually deleted from both stage/live tables?

Avatar
VPull

Community Member, 58 Posts

17 March 2017 at 8:19pm

Hi @nzphoenix,

Do you get any solution on that, I am facing the same problem when I tried to delete dataobject from model admin.
Silverstripe version 3.5

Avatar
nzphoenix

Community Member, 2 Posts

20 March 2017 at 1:33pm

Can't fully remember what the solution was here I'm afraid! I think we probably came up with a workaround.