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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Sorting bug


Go to End


787 Views

Avatar
k0m0r

Community Member, 39 Posts

16 August 2010 at 8:16pm

Hi.
I've encountered a strange bug when trying to sort DOM items by specific params.
My code looks like this:

$manager = new DataObjectManager(
 $this,
 'MyObjects',
 'MyObject',
 array(
  'Title' => 'Title',
  'Date' => 'Date',
 ), 
 'getCMSFields_forPopup',
 '',
 'Title DESC, ID DESC'
);
$fields->addFieldToTab('Root.Content.MyObjects', $manager);

The manager works just fine, but when I try to open a pop-up, an SQL error occurs.
I noticed that the problem is with the sorting params, the SQL statement for the popup contains a following piece of code:

ORDER BY Title DESC, ID DESC ASC LIMIT 10

Notice that the 'ASC' param is added unnecessarely.
How do I fix that?