private function reduceCursorForGroups()
    {
        $reduceForGroups = $groupKeys = [];
        $index = 0;
        foreach ($this->collectionCursor as $model) {
            $groupKey = $this->getGroupKeyForModel($model);
            if ($groupKey != '') {
                if (!in_array($groupKey, $groupKeys)) {
                    $groupKeys[] = $groupKey;
                } else {
                    $reduceForGroups[] = $index;
                }
            }
            $index++;
        }

        if (count($reduceForGroups) > 0) {
            $this->collectionCursor->filterModelsByIndex($reduceForGroups);
        }
    }
private function reduceCursorForGroups()
    {
        $reduceForGroups = $groupKeys = [];
        $index = 0;
        foreach ($this->collectionCursor as $model) {
            $groupKey = $this->getGroupKeyForModel($model);
            if ($groupKey != '') {
                if (!in_array($groupKey, $groupKeys)) {
                    $groupKeys[] = $groupKey;
                } else {
                    $reduceForGroups[] = $index;
                }
            }
            $index++;
        }

        if (count($reduceForGroups) > 0) {
            $this->collectionCursor->filterModelsByIndex($reduceForGroups);
        }
    }
private function reduceCursorForGroups ( ) { $ reduceForGroups = $ groupKeys = [ ] ; $ index = 0 ; foreach ( $ this -> collectionCursor as $ model ) { $ groupKey = $ this -> getGroupKeyForModel ( $ model ) ; if ( $ groupKey != '' ) { if ( ! in_array ( $ groupKey , $ groupKeys ) ) { $ groupKeys [ ] = $ groupKey ; } else { $ reduceForGroups [ ] = $ index ; } } $ index ++ ; } if ( count ( $ reduceForGroups ) > 0 ) { $ this -> collectionCursor -> filterModelsByIndex ( $ reduceForGroups ) ; } }
Removes results which should be collapsed into a single grouped result
Removes results which should be collapsed into a single grouped result