mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Fixed PHP notice in DataObjectSet::groupBy() by defining $result before returning it
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@83450 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5329e9bfc5
commit
99038acbf1
@ -676,8 +676,9 @@ class DataObjectSet extends ViewableData implements IteratorAggregate {
|
||||
* @param string $index The field name to index the array by.
|
||||
* @return array
|
||||
*/
|
||||
public function groupBy($index){
|
||||
foreach($this->items as $item ){
|
||||
public function groupBy($index) {
|
||||
$result = array();
|
||||
foreach($this->items as $item) {
|
||||
if(!isset($result[$item->$index])) {
|
||||
$result[$item->$index] = new DataObjectSet();
|
||||
}
|
||||
@ -1110,4 +1111,4 @@ class DataObjectSet_Iterator implements Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user