Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR : Update core docs to use DataList::create() rather than DataOb…

…ject::get()/get_one()/get_by_id() where appropriate - Trac#6891
  • Loading branch information...
commit 9e60225064d19eb20c2cf5f409aef73764fcc4bd 1 parent 6fb95e0
@normann normann authored chillu committed
View
4 forms/OptionsetField.php
@@ -28,10 +28,10 @@
*
* <code>
* //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(
View
2  model/DataList.php
@@ -658,7 +658,7 @@ public function getIDList() {
*
* Example: Get members from all Groups:
*
- * DataObject::get("Group")->relation("Members")
+ * DataList::Create("Group")->relation("Members")
*
* @param string $relationName
* @return HasManyList|ManyManyList
View
29 model/DataObject.php
@@ -309,7 +309,7 @@ function __construct($record = null, $isSingleton = false, $model = null) {
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 @@ public function getReverseAssociation($className) {
}
/**
- * @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 @@ public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $res
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 @@ public static function get($callerClass, $filter = "", $sort = "", $join = "", $
}
/**
- * @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 @@ public function Aggregate($class = null) {
}
/**
- * @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 @@ public function RelationshipAggregate($relationship) {
* @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 @@ static function reset() {
/**
* 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 @@ static function reset() {
* @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);
}
View
2  model/DataQuery.php
@@ -145,7 +145,7 @@ function getFinalisedQuery() {
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) . "')";
}
}
View
2  model/Versioned.php
@@ -1006,7 +1006,7 @@ function isLatestVersion() {
}
/**
- * 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.
Please sign in to comment.
Something went wrong with that request. Please try again.