mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX joinClass's default_sort is used when nothing else has been set already
This commit is contained in:
parent
4aa7fb70ee
commit
ac1fe5e9d5
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM;
|
namespace SilverStripe\ORM;
|
||||||
|
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Dev\Deprecation;
|
use SilverStripe\Dev\Deprecation;
|
||||||
@ -253,6 +254,13 @@ class ManyManyThroughQueryManipulator implements DataQueryManipulator
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set a default sort from the join model if available and nothing is already set
|
||||||
|
if (empty($sqlSelect->getOrderBy())
|
||||||
|
&& $sort = Config::inst()->get($this->getJoinClass(), 'default_sort')
|
||||||
|
) {
|
||||||
|
$sqlSelect->setOrderBy($sort);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply join and record sql for later insertion (at end of replacements)
|
// Apply join and record sql for later insertion (at end of replacements)
|
||||||
// By using a string placeholder $$_SUBQUERY_$$ we protect field/table rewrites from interfering twice
|
// By using a string placeholder $$_SUBQUERY_$$ we protect field/table rewrites from interfering twice
|
||||||
// on the already-finalised inner list
|
// on the already-finalised inner list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user