Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT SS_Map_Iterator::rewind() SS_Map_Iterator::current() will

return the titleField if there's a method of the same name (same
behaviour as DataObjectSet::map() from SS 2.4)
  • Loading branch information...
commit f5a91cbbe89f83a0561c1c921fae9cd5db11d3f5 1 parent fc9e065
@halkyon halkyon authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 model/Map.php
View
8 model/Map.php
@@ -165,7 +165,9 @@ public function rewind() {
if(isset($this->firstItems[$this->firstItemIdx])) {
return $this->firstItems[$this->firstItemIdx][1];
} else {
- if($rewoundItem) return $rewoundItem->{$this->titleField};
+ if($rewoundItem) return ($rewoundItem->hasMethod($this->titleField))
+ ? $rewoundItem->{$this->titleField}()
+ : $rewoundItem->{$this->titleField};
}
}
@@ -174,7 +176,9 @@ public function current() {
if(isset($this->firstItems[$this->firstItemIdx])) {
return $this->firstItems[$this->firstItemIdx][1];
} else {
- return $this->items->current()->{$this->titleField};
+ return ($this->items->current()->hasMethod($this->titleField))
+ ? $this->items->current()->{$this->titleField}()
+ : $this->items->current()->{$this->titleField};
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.