Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: Tidied up relObject() behaviour on DataLists to restore broke…

…n SearchContext functionality.
  • Loading branch information...
commit 58433d38ced3d255d2704271cc80a7f163cad910 1 parent c56176c
@sminnee sminnee authored
Showing with 16 additions and 2 deletions.
  1. +4 −0 model/DataList.php
  2. +12 −2 model/DataObject.php
View
4 model/DataList.php
@@ -668,6 +668,10 @@ public function relation($relationName) {
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
14 model/DataObject.php
@@ -2404,7 +2404,12 @@ public function relObject($fieldPath) {
// 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 @@ public function relField($fieldPath) {
// 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;
Please sign in to comment.
Something went wrong with that request. Please try again.