Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #433 from halkyon/use_of_deprecated_code

Replacing internal use of deprecated code
  • Loading branch information...
commit f27de361d874f374fc7abecd83075f7cd7e6fabb 2 parents 448b214 + 46f51d5
@sminnee sminnee authored
View
8 model/Aggregate.php
@@ -78,8 +78,8 @@ public function __construct($type, $filter = '') {
protected function query($attr) {
$singleton = singleton($this->type);
$query = $singleton->buildSQL($this->filter);
- $query->select($attr);
- $query->orderby = null;
+ $query->setSelect($attr);
+ $query->setOrderBy(array());
$singleton->extend('augmentSQL', $query);
return $query;
}
@@ -161,8 +161,8 @@ protected function query($attr) {
$query = $this->object->getManyManyComponentsQuery($this->relationship, $this->filter);
}
- $query->select($attr);
- $query->groupby = array();
+ $query->setSelect($attr);
+ $query->setGroupBy(array());
$singleton = singleton($this->type);
$singleton->extend('augmentSQL', $query);
View
42 model/SQLQuery.php
@@ -142,10 +142,10 @@ function __set($field, $value) {
*
* <code>
* // pass fields to select as single parameter array
- * $query->select(array("Col1","Col2"))->from("MyTable");
+ * $query->setSelect(array("Col1","Col2"))->setFrom("MyTable");
*
* // pass fields to select as multiple parameters
- * $query->select("Col1", "Col2")->from("MyTable");
+ * $query->setSelect("Col1", "Col2")->setFrom("MyTable");
* </code>
*
* @param string|array $fields
@@ -167,10 +167,10 @@ public function setSelect($fields) {
*
* <code>
* // pass fields to select as single parameter array
- * $query->select(array("Col1","Col2"))->from("MyTable");
+ * $query->addSelect(array("Col1","Col2"))->setFrom("MyTable");
*
* // pass fields to select as multiple parameters
- * $query->select("Col1", "Col2")->from("MyTable");
+ * $query->addSelect("Col1", "Col2")->setFrom("MyTable");
* </code>
*
* @param string|array $fields
@@ -229,7 +229,7 @@ public function expressionForField($field) {
* Set table for the SELECT clause.
*
* <code>
- * $query->from("MyTable"); // SELECT * FROM MyTable
+ * $query->setFrom("MyTable"); // SELECT * FROM MyTable
* </code>
*
* @param string|array $from
@@ -244,7 +244,7 @@ public function setFrom($from) {
* Add a table to the SELECT clause.
*
* <code>
- * $query->from("MyTable"); // SELECT * FROM MyTable
+ * $query->addFrom("MyTable"); // SELECT * FROM MyTable
* </code>
*
* @param string|array $from
@@ -937,13 +937,13 @@ function unlimitedRowCount($column = null) {
return $countQuery->execute()->value();
} else {
- $clone->select = array("count(*)");
+ $clone->setSelect(array("count(*)"));
}
} else {
- $clone->select = array("count($column)");
+ $clone->setSelect(array("count($column)"));
}
- $clone->groupby = null;
+ $clone->setGroupBy(array());;
return $clone->execute()->value();
}
@@ -993,23 +993,23 @@ function count( $column = null) {
}
}
- /**
- * Return a new SQLQuery that calls the given aggregate functions on this data.
- * @param $column An aggregate expression, such as 'MAX("Balance")', or a set of them.
- */
- function aggregate($column) {
+ /**
+ * Return a new SQLQuery that calls the given aggregate functions on this data.
+ * @param $column An aggregate expression, such as 'MAX("Balance")', or a set of them.
+ */
+ function aggregate($column) {
if($this->groupby || $this->limit) {
- throw new Exception("SQLQuery::aggregate() doesn't work with groupby or limit, yet");
- }
+ throw new Exception("SQLQuery::aggregate() doesn't work with groupby or limit, yet");
+ }
$clone = clone $this;
- $clone->limit = null;
- $clone->orderby = null;
- $clone->groupby = null;
- $clone->select($column);
+ $clone->setLimit(array());
+ $clone->setOrderBy(array());
+ $clone->setGroupBy(array());
+ $clone->setSelect($column);
return $clone;
- }
+ }
/**
* Returns a query that returns only the first row of this query
View
6 model/Versioned.php
@@ -154,15 +154,15 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
$query->selectField(sprintf('"%s_versions"."%s"', $baseTable, 'RecordID'), "ID");
if($table != $baseTable) {
- $query->from(array($table => " AND \"{$table}_versions\".\"Version\" = \"{$baseTable}_versions\".\"Version\""));
+ $query->addFrom(array($table => " AND \"{$table}_versions\".\"Version\" = \"{$baseTable}_versions\".\"Version\""));
}
}
// Link to the version archived on that date
$archiveTable = $this->requireArchiveTempTable($baseTable, $date);
- $query->from[$archiveTable] = "INNER JOIN \"$archiveTable\"
+ $query->addFrom(array($archiveTable => "INNER JOIN \"$archiveTable\"
ON \"$archiveTable\".\"ID\" = \"{$baseTable}_versions\".\"RecordID\"
- AND \"$archiveTable\".\"Version\" = \"{$baseTable}_versions\".\"Version\"";
+ AND \"$archiveTable\".\"Version\" = \"{$baseTable}_versions\".\"Version\""));
break;
// Reading a specific stage (Stage or Live)
View
4 model/fieldtypes/CompositeDBField.php
@@ -37,8 +37,8 @@
*
* function addToQuery(&$query) {
* parent::addToQuery($query);
-* $query->select("{$this->name}Number");
-* $query->select("{$this->name}Name");
+* $query->setSelect("{$this->name}Number");
+* $query->setSelect("{$this->name}Name");
* }
*
* function setValue($value, $record = null, $markChanged=true) {
View
2  tests/core/ArrayDataTest.php
@@ -68,7 +68,7 @@ function testGetArray() {
$arrayData = new ArrayData($array);
- $this->assertEquals($arrayData->getArray(), $array);
+ $this->assertEquals($arrayData->toMap(), $array);
Deprecation::restore_settings($originalDeprecation);
}
Please sign in to comment.
Something went wrong with that request. Please try again.