mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Tidied up relObject() behaviour on DataLists to restore broken SearchContext functionality.
This commit is contained in:
parent
c56176c5d5
commit
58433d38ce
@ -668,6 +668,10 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||||||
return singleton($this->dataClass)->$relationName()->forForeignID($ids);
|
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.
|
* Add a number of items to the component set.
|
||||||
*
|
*
|
||||||
|
@ -2404,8 +2404,13 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// Traverse dot syntax
|
// Traverse dot syntax
|
||||||
$component = $this;
|
$component = $this;
|
||||||
foreach($parts as $relation) {
|
foreach($parts as $relation) {
|
||||||
|
if($component instanceof SS_List) {
|
||||||
|
if(method_exists($component,$relation)) $component = $component->$relation();
|
||||||
|
else $component = $component->relation($relation);
|
||||||
|
} else {
|
||||||
$component = $component->$relation();
|
$component = $component->$relation();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object = $component->dbObject($fieldName);
|
$object = $component->dbObject($fieldName);
|
||||||
|
|
||||||
@ -2436,8 +2441,13 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// Traverse dot syntax
|
// Traverse dot syntax
|
||||||
$component = $this;
|
$component = $this;
|
||||||
foreach($parts as $relation) {
|
foreach($parts as $relation) {
|
||||||
|
if($component instanceof SS_List) {
|
||||||
|
if(method_exists($component,$relation)) $component = $component->$relation();
|
||||||
|
else $component = $component->relation($relation);
|
||||||
|
} else {
|
||||||
$component = $component->$relation();
|
$component = $component->$relation();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $component->$fieldName;
|
return $component->$fieldName;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user