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

Sortable Data Object Not Working?


Reply

3 Posts   1226 Views

Avatar
DanStephenson

12 May 2009 at 2:36pm (Last edited: 12 May 2009 2:56pm), Community Member, 115 Posts

I am trying to make my dataobject called Models sortable. When I add the following code to my _config.php file:

SortableDataObject::add_sortable_class('Model');

Then I do a /dev/build/, I am taken to an admin login where I put in the username and password, but it never lets me login. Any idea what could be wrong?

Avatar
DanStephenson

12 May 2009 at 4:28pm (Last edited: 12 May 2009 4:57pm), Community Member, 115 Posts

I am now getting an error message that there is a problem with the output at Line 1 of Model.php. I've pasted my code below, if anyone can see what's wrong.

<?php
class Model extends DataObject {
   static $db = array (
      'ModelName' => 'Text',
      'ModelLink' => 'Text'
   );
   
   static $has_one = array (
      'BrandPage' => 'BrandPage'
   );
   
   public function getCMSFields_forPopup()
   {
      return new FieldSet(
         new TextField('ModelName'),
         new TextField('ModelLink')
      );
   }
   
   function Second(){
      return $this->iteratorPos % 2;
   }
}
?>

Avatar
UncleCheese

13 May 2009 at 1:52am 4085 Posts

This is just a guess, but I'll bet Model is a reserved classname.