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:
Sean Harvey 2009-08-01 08:44:25 +00:00 committed by Sam Minnee
parent 5329e9bfc5
commit 99038acbf1

View File

@ -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 {
}
}
?>
?>