BUGFIX: Filter on the baseclassid in Hierachy, not the class id, in case the class doesnt have a table (aoneil)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67268 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Josh Kosmala 2008-12-03 02:41:25 +00:00 committed by Sam Minnee
parent e802eaa1d9
commit d839201092

View File

@ -510,9 +510,10 @@ class Hierarchy extends DataObjectDecorator {
*/ */
public function getParent($filter = '') { public function getParent($filter = '') {
if($p = $this->owner->__get("ParentID")) { if($p = $this->owner->__get("ParentID")) {
$className = $this->owner->class; $tableClasses = ClassInfo::dataClassesFor($this->owner->class);
$filter .= $filter?" AND ":""."`$className`.ID = $p"; $baseClass = array_shift($tableClasses);
return DataObject::get_one($className, $filter); $filter .= $filter?" AND ":""."`$baseClass`.ID = $p";
return DataObject::get_one($this->owner->class, $filter);
} }
} }