7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » [SOLVED]Latest revision fails on Sort field
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 680 Views |
-
[SOLVED]Latest revision fails on Sort field

29 January 2010 at 10:07am Last edited: 29 January 2010 10:55am
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(
'Family','Genus','Species','CommonName'
);
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 rev347any ideas??
-
Re: [SOLVED]Latest revision fails on Sort field

29 January 2010 at 10:20am
Hi, Nick,
Could you paste the exact error, please?
-
Re: [SOLVED]Latest revision fails on Sort field

29 January 2010 at 10:22am
Oh, you might want to try "Genus ASC" for your sort clause. Let me know if that fixes anything.
-
Re: [SOLVED]Latest revision fails on Sort field

29 January 2010 at 10:28am
Ha, yes thats cracked it! Is this a recent change (explicit sort direction required)?
-
Re: [SOLVED]Latest revision fails on Sort field

29 January 2010 at 10:51am
Yeah, stupid me. I'll be checking in a patch momentarily.
| 680 Views | ||
|
Page:
1
|
Go to Top |
