Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Sorting bug

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 483 Views
  • k0m0r
    Avatar
    Community Member
    39 Posts

    Sorting bug Link to this post

    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?

    483 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.