diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 0fd559841..8cdb49e6d 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -1169,6 +1169,7 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP // database inconsistencies $componentBaseClass = ClassInfo::baseDataClass($componentClass); + $query = $componentObj->extendedSQL( "`$table`.$parentField = $this->ID", // filter $sort, @@ -1177,22 +1178,6 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP ); array_unshift($query->select, "`$table`.*"); - // FIXME: We were having database crashing troubles with GIS content being accessed from with the link - // tracking join. In order to fix it, we're altering the query just for this many-many relation. - // The more long-term fix to this is to let developers specify which data columns they are actually interested - // in, and thereby optimise the query in a more loosely coupled fashion. - if($table == "SiteTree_LinkTracking") { - $filteredSelect = array(); - foreach($query->select as $item) { - if(strpos($item,'SiteTree') !== false) $filteredSelect[] = $item; - } - $query->select = $filteredSelect; - $query->from = array( - "SiteTree" => $query->from["SiteTree"], - $query->from[0], - ); - } - if($filter) $query->where[] = $filter; if($join) $query->from[] = $join;