From 5499079c1c4f605cf606ccaf36d4bbaaa5dce31e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 5 Jun 2012 11:07:19 +1200 Subject: [PATCH] BUGFIX: Fixed ORM bugs introduced in ec554689325765881a83df6f87c34efe80c92961 --- model/DataObject.php | 4 ++-- model/DataQuery.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/DataObject.php b/model/DataObject.php index 0db6496eb..f582b47cb 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -2942,8 +2942,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // 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); diff --git a/model/DataQuery.php b/model/DataQuery.php index 7fd0ac598..2e5c66866 100644 --- a/model/DataQuery.php +++ b/model/DataQuery.php @@ -199,8 +199,8 @@ class DataQuery { $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 @@ class DataQuery { $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) . ")"); } }