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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

[DataObjectManager] - [Warning] DataObject::get_by_id passed a non-numeric ID #18


3 Posts   2592 Views

Lamin Barrow

12 May 2009 at 4:12am (Last edited: 4 September 2009 9:16pm), Community Member, 21 Posts


I have been working with DataOjectManager module for sometime now i am so much in love with the thing. Recently i have been having the following stack trace error pop up whenever i try post a new image using a new page type i have recently created. I can see that everything saves just after i close the fancybox window but the initial saving is where the problem is. Below is some of the stack trace error code.

[Warning] DataObject::get_by_id passed a non-numeric ID #18
POST /projectName/admin/EditForm/field/Homes/UploadForm?ctf[Homes][per_page]=10&ctf[Homes][showall]=0&ctf[Homes][sort]=Created&ctf[Homes][sort_dir]=DESC&ctf[Homes][search]=&ctf[Homes][filter]=&ctf[Homes][view]=grid&ctf[Homes][imagesize]=100

Line 2413 in C:\wamp\www\projectName\sapphire\core\model\DataObject.php

This is the code for the new page type class extending the DataObject class


class Home extends DataObject
   static $db = array (
      'Name' => 'Text',
      'PhotoDescription' => 'HTMLText(1024)'
   static $has_one = array (
      'Photo' => 'Image',
      'HomePage' => 'HomePage'
   public function getCMSFields_forPopup()
      return new FieldSet(
         new TextField('Name'),
         new TextareaField('PhotoDescription', 'Photo Description'),
         new ImageField('Photo')

and finally here is some of the code for the PageType Model itself

class HomePage extends Page
static $db = array(
      //'Introduction' => 'HTMLVarchar',
      'GoalsAndObjectives' => 'HTMLVarchar(5000)'      
static $has_one = array(
      "InternalLink" => "SiteTree",

static $has_many = array (
      'Homes' => 'Home'

static $icon = "themes/light/images/treeicons/home";

public function getCMSFields()
      $fields = parent::getCMSFields();

      $manager = new ImageDataObjectManager(
         $this, // Controller
         'Homes', // Source name
         'Home', // Source class
         'Photo', // File name on DataObject
            'Name' => 'Name',
            'PhotoDescription' => 'PhotoDescription'
         ), // Headings
         'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
         // Filter clause
         // Sort clause
         // Join clause
      $fields->addFieldToTab("Root.Content.Photo Slide Show", $manager);
       $fields->addFieldToTab("Root.Content.Featured Link", new TreeDropdownField("InternalLinkID", "InternalLink", "SiteTree"));
      $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("GoalsAndObjectives", "Goals and Objectives"));
      return $fields;


I am running the Latest SVN build (142) of the DOM module. This is my first forum post here and also the first time i am have encountered an error like this. Any help will be greatly appreciated. Thank you. :D


13 May 2009 at 1:55am 4085 Posts

Let me just make sure I know exactly where the error is happening.

You upload one or many images, they get accepted, and then it walks you through each one in the "Editing Image 1 of XXX" form. When you click save on the form, it throws the error? But when you close the modal window, everything is fine?

Lamin Barrow

13 May 2009 at 4:31am (Last edited: 4 September 2009 9:17pm), Community Member, 21 Posts

The error comes after i hit the upload button and then whole process dies. This is the entire error trace log is showed me this time.

[Warning] DataObject::get_by_id passed a non-numeric ID #21
POST /projectName/admin/EditForm/field/Homes/UploadForm?ctf[Homes][per_page]=10&ctf[Homes][showall]=0&ctf[Homes][sort]=Created&ctf[Homes][sort_dir]=DESC&ctf[Homes][search]=&ctf[Homes][filter]=&ctf[Homes][view]=grid&ctf[Homes][imagesize]=100

Line 2413 in C:\wamp\www\ projectName\sapphire\core\model\DataObject.php
2404             $tableClasses = ClassInfo::dataClassesFor($callerClass);
2405             $baseClass = array_shift($tableClasses);
2406             return DataObject::get_one($callerClass,"`$baseClass`.`ID` = $id");
2408             // This simpler code will be used by non-DataObject classes that implement DataObjectInterface
2409          } else {
2410             return DataObject::get_one($callerClass,"`ID` = $id");
2411          }
2412       } else {
2413          user_error("DataObject::get_by_id passed a non-numeric ID #$id", E_USER_WARNING);
2414       }
2415    }
2417    /**
2418     * Get the name of the base table for this object
2419     */
DataObject::get_by_id passed a non-numeric ID #21
Line 2413 of DataObject.php
Line 363 of FileDataObjectManager.php
Line 315 of FileDataObjectManager.php
Line 228 of Form.php
Line 107 of RequestHandler.php
Line 121 of RequestHandler.php
Line 121 of RequestHandler.php
Line 121 of RequestHandler.php
Line 122 of Controller.php
Line 277 of Director.php
Line 121 of Director.php
Line 115 of main.php

So after i close the fancybox window, i can see that all the images i uploaded are there and that i can edit the various text fields but when i try replace the image i am getting it throws up this error

[Notice] Undefined index: ImageSource
line 706 in C:\wamp\www\ projectName\sapphire\core\model\Image.php

I know the fault is possibly in my code but I dont know where to find it.