BUGFIX: Tidied up relObject() behaviour on DataLists to restore broken SearchContext functionality.

This commit is contained in:
Sam Minnee 2012-03-30 15:59:47 +13:00
parent c56176c5d5
commit 58433d38ce
2 changed files with 16 additions and 2 deletions

View File

@ -668,6 +668,10 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
return singleton($this->dataClass)->$relationName()->forForeignID($ids);
}
function dbObject($fieldName) {
return singleton($this->dataClass)->dbObject($fieldName);
}
/**
* Add a number of items to the component set.
*

View File

@ -2404,7 +2404,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Traverse dot syntax
$component = $this;
foreach($parts as $relation) {
$component = $component->$relation();
if($component instanceof SS_List) {
if(method_exists($component,$relation)) $component = $component->$relation();
else $component = $component->relation($relation);
} else {
$component = $component->$relation();
}
}
$object = $component->dbObject($fieldName);
@ -2436,7 +2441,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Traverse dot syntax
$component = $this;
foreach($parts as $relation) {
$component = $component->$relation();
if($component instanceof SS_List) {
if(method_exists($component,$relation)) $component = $component->$relation();
else $component = $component->relation($relation);
} else {
$component = $component->$relation();
}
}
return $component->$fieldName;