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   1280 Views

Avatar
DanStephenson

Community Member, 116 Posts

12 May 2009 at 2:36pm

Edited: 12/05/2009 2:56pm

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

Community Member, 116 Posts

12 May 2009 at 4:28pm

Edited: 12/05/2009 4:57pm

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

Forum Moderator, 4096 Posts

13 May 2009 at 1:52am

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