pimcore

Pimcore: How to sort a data object listing by data object modification date?


As simple as the title...

PS: this does not work

$news = new News\Listing();
$news->setOrderKey("o_modificationDate");
$news->setOrder("DESC");

Column not found: 1054 Unknown column 'o_modificationDate' in 'order clause'

Solution

  • For Pimcore 11, just omit the o_ prefix. It was removed in this PR.

    $news = new News\Listing();
    $news->setOrderKey("modificationDate");
    $news->setOrder("DESC");