BUGFIX: Fixed ORM bugs introduced in ec55468932

This commit is contained in:
Sam Minnee 2012-06-05 11:07:19 +12:00
parent 64aa2ad170
commit 5499079c1c
2 changed files with 5 additions and 5 deletions

View File

@ -2942,8 +2942,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Build index list // Build index list
$manymanyIndexes = array( $manymanyIndexes = array(
"\"{$this->class}ID\"" => true, "{$this->class}ID" => true,
(($this->class == $childClass) ? "ChildID" : "\"{$childClass}ID\"") => true, (($this->class == $childClass) ? "ChildID" : "{$childClass}ID") => true,
); );
DB::requireTable("{$this->class}_$relationship", $manymanyFields, $manymanyIndexes, true, null, $extensions); DB::requireTable("{$this->class}_$relationship", $manymanyFields, $manymanyIndexes, true, null, $extensions);

View File

@ -199,8 +199,8 @@ class DataQuery {
$collisionBase = $matches[1]; $collisionBase = $matches[1];
$collisionClasses = ClassInfo::subclassesFor($collisionBase); $collisionClasses = ClassInfo::subclassesFor($collisionBase);
$collisionClasses = array_map(array(DB::getConn(), 'prepStringForDB'), $collisionClasses); $collisionClasses = array_map(array(DB::getConn(), 'prepStringForDB'), $collisionClasses);
$caseClauses[] = "WHEN \"$baseClass\".\"ClassName\" IN ('" $caseClauses[] = "WHEN \"$baseClass\".\"ClassName\" IN ("
. implode("', '", $collisionClasses) . "') THEN $collision"; . implode(", ", $collisionClasses) . ") THEN $collision";
} else { } else {
user_error("Bad collision item '$collision'", E_USER_WARNING); user_error("Bad collision item '$collision'", E_USER_WARNING);
} }
@ -217,7 +217,7 @@ class DataQuery {
$classNames = ClassInfo::subclassesFor($this->dataClass); $classNames = ClassInfo::subclassesFor($this->dataClass);
if(!$classNames) user_error("DataList::create() Can't find data sub-classes for '$callerClass'"); if(!$classNames) user_error("DataList::create() Can't find data sub-classes for '$callerClass'");
$classNames = array_map(array(DB::getConn(), 'prepStringForDB'), $classNames); $classNames = array_map(array(DB::getConn(), 'prepStringForDB'), $classNames);
$query->addWhere("\"$baseClass\".\"ClassName\" IN ('" . implode("','", $classNames) . "')"); $query->addWhere("\"$baseClass\".\"ClassName\" IN (" . implode(",", $classNames) . ")");
} }
} }