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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

OnBeforeDelete in DataExtension - What's it for?

Go to End

3 Posts   724 Views


Community Member, 97 Posts

23 August 2014 at 4:54am

When I use DataExtension to add $has_many pdf files, I want to use OnBeforeDelete within the DataExtension subclass to remove those files before the deletion of the data object itself. But it seems not working.

To get around, I have to add codes into the data object's own class, which is not very ideal because the class doesn't have codes mentioning the pdf files.

Is this a limitation of the DataExtension of do i miss something?



Forum Moderator, 1390 Posts

25 August 2014 at 8:47pm

onBeforeDelete() should work if your DataExtension extends the DataObject that is deleted. To have an idea what's wrong we'd need a to have a look at the code...


Community Member, 97 Posts

26 August 2014 at 11:11pm

you are right it works ok.

Like other functions, i need to use $this->owner->Images() to remove images