Merge pull request #1126 from silverstripe-rebelalliance/open/8183

BUG: Replaced extendedSQL/buildSQL with DataList as per ticket 8183
This commit is contained in:
Ingo Schommer 2013-01-23 14:51:27 -08:00
commit ac0edbf83f
3 changed files with 6 additions and 4 deletions

View File

@ -76,8 +76,7 @@ class Aggregate extends ViewableData {
* @return SQLQuery
*/
protected function query($attr) {
$singleton = singleton($this->type);
$query = $singleton->buildSQL($this->filter);
$query = DataList::create($this->type)->where($this->filter);
$query->setSelect($attr);
$query->setOrderBy(array());
$singleton->extend('augmentSQL', $query);

View File

@ -1434,7 +1434,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$combinedFilter = "\"$joinField\" = '$id'";
if(!empty($filter)) $combinedFilter .= " AND ({$filter})";
return singleton($componentClass)->extendedSQL($combinedFilter, $sort, $limit, $join);
return DataList::create($componentClass)
->where($combinedFilter)
->canSortBy($sort)
->limit($limit);
}
/**

View File

@ -111,7 +111,7 @@ class DataQuery {
user_error("DataObjects have been requested before the manifest is loaded. Please ensure you are not"
. " querying the database in _config.php.", E_USER_ERROR);
} else {
user_error("DataObject::buildSQL: Can't find data classes (classes linked to tables) for"
user_error("DataList::create Can't find data classes (classes linked to tables) for"
. " $this->dataClass. Please ensure you run dev/build after creating a new DataObject.",
E_USER_ERROR);
}