From e1e64839e2aa84d76dbe32422d748c5e8952a878 Mon Sep 17 00:00:00 2001 From: Kirk Mayo Date: Thu, 24 Jan 2013 08:41:37 +1300 Subject: [PATCH] BUG: Replaced extendedSQL/buildSQL with DataList as per ticket 8183 BUG: Correcting the4 case of a function Corrcting the case of a function BUG: replaced deprecated extendedSQL call with DataList->where --- model/Aggregate.php | 3 +-- model/DataObject.php | 5 ++++- model/DataQuery.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/model/Aggregate.php b/model/Aggregate.php index 5d03c77fa..295131b57 100644 --- a/model/Aggregate.php +++ b/model/Aggregate.php @@ -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); diff --git a/model/DataObject.php b/model/DataObject.php index 64fde80ca..f8ea6c0ce 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -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); } /** diff --git a/model/DataQuery.php b/model/DataQuery.php index bc0382423..7a0ecc446 100644 --- a/model/DataQuery.php +++ b/model/DataQuery.php @@ -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); }