Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObject::delete() called on a DataObject without an ID

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 611 Views
  • pinkp
    Avatar
    Community Member
    168 Posts

    DataObject::delete() called on a DataObject without an ID Link to this post

    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

    611 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.