Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: Fixed ORM bugs introduced in ec55468

  • Loading branch information...
commit 5499079c1c4f605cf606ccaf36d4bbaaa5dce31e 1 parent 64aa2ad
Sam Minnée sminnee authored
Showing with 5 additions and 5 deletions.
  1. +2 −2 model/DataObject.php
  2. +3 −3 model/DataQuery.php
4 model/DataObject.php
View
@@ -2942,8 +2942,8 @@ public function requireTable() {
// Build index list
$manymanyIndexes = array(
- "\"{$this->class}ID\"" => true,
- (($this->class == $childClass) ? "ChildID" : "\"{$childClass}ID\"") => true,
+ "{$this->class}ID" => true,
+ (($this->class == $childClass) ? "ChildID" : "{$childClass}ID") => true,
);
DB::requireTable("{$this->class}_$relationship", $manymanyFields, $manymanyIndexes, true, null, $extensions);
6 model/DataQuery.php
View
@@ -199,8 +199,8 @@ function getFinalisedQuery($queriedColumns = null) {
$collisionBase = $matches[1];
$collisionClasses = ClassInfo::subclassesFor($collisionBase);
$collisionClasses = array_map(array(DB::getConn(), 'prepStringForDB'), $collisionClasses);
- $caseClauses[] = "WHEN \"$baseClass\".\"ClassName\" IN ('"
- . implode("', '", $collisionClasses) . "') THEN $collision";
+ $caseClauses[] = "WHEN \"$baseClass\".\"ClassName\" IN ("
+ . implode(", ", $collisionClasses) . ") THEN $collision";
} else {
user_error("Bad collision item '$collision'", E_USER_WARNING);
}
@@ -217,7 +217,7 @@ function getFinalisedQuery($queriedColumns = null) {
$classNames = ClassInfo::subclassesFor($this->dataClass);
if(!$classNames) user_error("DataList::create() Can't find data sub-classes for '$callerClass'");
$classNames = array_map(array(DB::getConn(), 'prepStringForDB'), $classNames);
- $query->addWhere("\"$baseClass\".\"ClassName\" IN ('" . implode("','", $classNames) . "')");
+ $query->addWhere("\"$baseClass\".\"ClassName\" IN (" . implode(",", $classNames) . ")");
}
}

2 comments on commit 5499079

Sean Harvey
Owner

6 unit tests are broken as a result of this and the original commit ec55468... are you looking into it Sam? http://teamcity.silverstripe.com/viewLog.html?buildId=7672&tab=buildResultsDiv&buildTypeId=bt27

Sam Minnée
Owner
Please sign in to comment.
Something went wrong with that request. Please try again.