diff --git a/forms/OptionsetField.php b/forms/OptionsetField.php index 50a39f6c0..353f8201d 100644 --- a/forms/OptionsetField.php +++ b/forms/OptionsetField.php @@ -28,10 +28,10 @@ * * * //Database request for the object - * $myDoSet = DataObject::get("FooBars",""); + * $myDoSet = DataList::create("FooBars",""); * if($myDoSet){ * // This returns an array of ID => Title - * $map = $myDoSet->toDropDownMap(); + * $map = $myDoSet->map(); * * // Instantiate the OptionsetField * $FieldList = new FieldList( diff --git a/model/DataList.php b/model/DataList.php index 1984af0df..931419c25 100644 --- a/model/DataList.php +++ b/model/DataList.php @@ -658,7 +658,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab * * Example: Get members from all Groups: * - * DataObject::get("Group")->relation("Members") + * DataList::Create("Group")->relation("Members") * * @param string $relationName * @return HasManyList|ManyManyList diff --git a/model/DataObject.php b/model/DataObject.php index 24c98d805..451a9905b 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -309,7 +309,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity else $passed = "The value '$record'"; user_error("DataObject::__construct passed $passed. It's supposed to be passed an array, - taken straight from the database. Perhaps you should use DataObject::get_one instead?", E_USER_WARNING); + taken straight from the database. Perhaps you should use DataList::create()->First(); instead?", E_USER_WARNING); $record = null; } @@ -2469,10 +2469,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated 3.0 Use DataObject::get and DataList to do your querying + * @deprecated 3.0 Use DataList::create and DataList to do your querying */ public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "") { - Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.'); + Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.'); return $this->extendedSQL($filter, $sort, $limit, $join, $having); } @@ -2483,10 +2483,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity private static $cache_buildSQL_query; /** - * @deprecated 3.0 Use DataObject::get and DataList to do your querying + * @deprecated 3.0 Use DataList::create and DataList to do your querying */ public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){ - Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.'); + Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.'); $dataList = DataObject::get($this->class, $filter, $sort, $join, $limit); return $dataList->dataQuery()->query(); } @@ -2521,10 +2521,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated 3.0 Use DataObject::get and DataList to do your querying + * @deprecated 3.0 Use DataList::create and DataList to do your querying */ public function Aggregate($class = null) { - Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.'); + Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.'); if($class) { $list = new DataList($class); @@ -2538,19 +2538,18 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated 3.0 Use DataObject::get and DataList to do your querying + * @deprecated 3.0 Use DataList::create and DataList to do your querying */ public function RelationshipAggregate($relationship) { - Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.'); + Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.'); return $this->$relationship(); } /** - * The internal function that actually performs the querying for get(). - * DataObject::get("Table","filter") is the same as singleton("Table")->instance_get("filter") + * DataList::create("Table")->where("filter") is the same as singleton("Table")->instance_get("filter") * - * @deprecated 3.0 Use DataObject::get and DataList to do your querying + * @deprecated 3.0 Use DataList::create and DataList to do your querying * * @param string $filter A filter to be inserted into the WHERE clause. * @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used. @@ -2561,7 +2560,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return mixed The objects matching the filter, in the class specified by $containerClass */ public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") { - Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.'); + Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.'); return self::get($this->class, $filter, $sort, $join, $limit, $containerClass); } @@ -2693,7 +2692,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity /** * Does the hard work for get_one() * - * @deprecated 3.0 Use DataObject::get_one() instead + * @deprecated 3.0 Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead * * @uses DataExtension->augmentSQL() * @@ -2702,7 +2701,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return DataObject The first item matching the query */ public function instance_get_one($filter, $orderby = null) { - Deprecation::notice('3.0', 'Use DataObject::get_one() instead.'); + Deprecation::notice('3.0', 'Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead.'); return DataObject::get_one($this->class, $filter, true, $orderby); } diff --git a/model/DataQuery.php b/model/DataQuery.php index 2dad960fd..03d32c9f3 100644 --- a/model/DataQuery.php +++ b/model/DataQuery.php @@ -145,7 +145,7 @@ class DataQuery { if($this->dataClass != $baseClass) { // Get the ClassName values to filter to $classNames = ClassInfo::subclassesFor($this->dataClass); - if(!$classNames) user_error("DataObject::get() Can't find data sub-classes for '$callerClass'"); + if(!$classNames) user_error("DataList::create() Can't find data sub-classes for '$callerClass'"); $query->where[] = "\"$baseClass\".\"ClassName\" IN ('" . implode("','", $classNames) . "')"; } } diff --git a/model/Versioned.php b/model/Versioned.php index ce96c9338..fa446fafb 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -1006,7 +1006,7 @@ class Versioned extends DataExtension { } /** - * Return the equivalent of a DataObject::get() call, querying the latest + * Return the equivalent of a DataList::create() call, querying the latest * version of each page stored in the (class)_versions tables. * * In particular, this will query deleted records as well as active ones.