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:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObject::delete() called on a DataObject without an ID


Go to End


1068 Views

Avatar
pinkp

Community Member, 182 Posts

11 March 2012 at 10:36am

I have found some documentation on this error but don't really know how to fix it. Can someone help please.
When I try and remove an ImageGallery Page I get this error, I can unpublished or delete from draft. But not BOTH....

thanks

------------------------
500//ERROR [User Error]: Uncaught Exception: DataObject::delete() called on a DataObject without an ID
IN POST /mysite/admin/EditForm
Line 1126 in /Users/mysite/Sites/jcphotography/sapphire/core/model/DataObject.php

Source
======
1117: */
1118: public function delete() {
1119: $this->brokenOnDelete = true;
1120: $this->onBeforeDelete();
1121: if($this->brokenOnDelete) {
1122: user_error("$this->class has a broken onBeforeDelete() function. Make sure that you call
parent::onBeforeDelete().", E_USER_ERROR);
1123: }
1124:
1125: // Deleting a record without an ID shouldn't do anything
* 1126: if(!$this->ID) throw new Exception("DataObject::delete() called on a DataObject without an ID");
1127:
1128: foreach($this->getClassAncestry() as $ancestor) {
1129: if(self::has_own_table($ancestor)) {
1130: $sql = new SQLQuery();
1131: $sql->delete = true;
1132: $sql->from[$ancestor] = "\"$ancestor\"";

Trace
=====
<ul>DataObject->delete()
line 81 of ImageGalleryPage.php

ImageGalleryPage->onBeforeDelete()
line 1120 of DataObject.php

DataObject->delete()
line 696 of CMSMain.php

CMSMain->delete(Array,Form,SS_HTTPRequest)
line 329 of Form.php

Form->httpSubmission(SS_HTTPRequest)
line 143 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 282 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 125 of Director.php

Director::direct(/admin/EditForm)
line 127 of main.php

</ul>
http://localhost:8888/mysite/cms/javascript/LeftAndMain.js?m=1328047220
Line 497