mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
e802eaa1d9
commit
d839201092
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user