mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #277 from silverstripe-rebelalliance/open/8183
BUG: Replaced extendedSQL with DataList as per ticket 8183
This commit is contained in:
commit
6a4387b970
@ -19,14 +19,14 @@ class SiteTreeFolderExtension extends DataExtension {
|
||||
}
|
||||
|
||||
foreach($classes as $className) {
|
||||
$query = singleton($className)->extendedSQL();
|
||||
$query = new DataQuery($className);
|
||||
$ids = $query->execute()->column();
|
||||
if(!count($ids)) continue;
|
||||
|
||||
foreach(singleton($className)->has_one() as $relName => $joinClass) {
|
||||
if($joinClass == 'Image' || $joinClass == 'File') {
|
||||
$fieldName = $relName .'ID';
|
||||
$query = singleton($className)->extendedSQL("$fieldName > 0");
|
||||
$query = DataList::create($className)->where("$fieldName > 0");
|
||||
$query->distinct = true;
|
||||
$query->select(array($fieldName));
|
||||
$usedFiles = array_merge($usedFiles, $query->execute()->column());
|
||||
|
Loading…
Reference in New Issue
Block a user