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

[SOLVED]Latest revision fails on Sort field


5 Posts   792 Views


29 January 2010 at 10:07am (Last edited: 29 January 2010 10:55am), Community Member, 144 Posts

Hi, I've had a site running sweet with the DOM, and upgraded it to rev347 and now I get errors in the CMS (Undefined offset error). I've tracked it down to the Sort parameter...with anything in there I get the error....with no sort parameter specifed it works fine.

code is:

public function getCMSFields()
      $f = parent::getCMSFields();
      $manager = new DataObjectManager(
         $this, // Controller
         'Endangereds', // Source name
         'Endangered', // Source class
         array('Family' => 'Family', 'Genus' => 'Genus','Species' => 'Species','CommonName' => 'CommonName'), // Headings
         'getCMSFields_forPopup' // Detail fields function or FieldSet
         ,""// Filter clause
         ,"Genus"// Sort clause
         // Join clause
      $f->addFieldToTab("Root.Content.EndangeredList", $manager);
      return $f;

data object is:

class Endangered extends DataObject
   static $db = array (
      'Family' => 'Text',      
      'Genus' => 'Text',
      'Hybrid' => 'Text',
      'Species' => 'Text',      
      'Infraspecific' => 'Text',
      'Cultivar' => 'Text',
      'CultivarGroup' => 'Text',
      'Synonym' => 'Text',
      'CommonName' => 'Text',
      'Continent' => 'Text',
      'GeoRegion' => 'Text',
      'Herbarium' => 'Boolean',
      'IUCNCode' => 'Text',
      'Fieldx1' => 'Text',
      'Var' => 'Text'
   static $has_one = array (
      'EndangeredPage' => 'EndangeredPage',
      'PlantImage' => 'Image'
   static $searchable_fields = array(
   public function getCMSFields_forPopup()
      return new FieldSet(
         new TextField('Family'),
         new TextField('Fieldx1'),
         new TextField('Genus'),
         new TextField('Hybrid'),
         new TextField('Species'),
         new TextField('Var'),
         new TextField('Infraspecific'),
         new TextField('Cultivar'),
         new TextField('CultivarGroup'),
         new TextField('Synonym'),
         new TextField('CommonName'),
         new TextField('Continent'),
         new TextField('GeoRegion'),
         new CheckboxField('Herbarium','In herbarium?'),
         new TextField('IUCNCode'),
         new ImageField("PlantImage", "Plant Image")

If I remove Genus from the sort it works fine.....
running ss2.3.5 (stable) and DOM,SWFupload, Image_Gallery rev347

any ideas??


29 January 2010 at 10:20am 4085 Posts

Hi, Nick,

Could you paste the exact error, please?


29 January 2010 at 10:22am 4085 Posts

Oh, you might want to try "Genus ASC" for your sort clause. Let me know if that fixes anything.


29 January 2010 at 10:28am Community Member, 144 Posts

Ha, yes thats cracked it! Is this a recent change (explicit sort direction required)?


29 January 2010 at 10:51am 4085 Posts

Yeah, stupid me. I'll be checking in a patch momentarily.