public function groupBy(...$keys)
    {
        $data = [];

        while ($row = $this->getNextRow()) {

            $position = &$data;

            foreach ($keys as $key) {
                if (is_callable($key)) {
                    $value = $key($row);
                } else {
                    $value = $row[$key];
                }

                if (!array_key_exists($value, $position)) {
                    $position[$value] = [];
                }
                $position = &$position[$value];
            }

            $position[] = $row;
            unset($position);
        }

        return $data;
    }
public function groupBy(...$keys)
    {
        $data = [];

        while ($row = $this->getNextRow()) {

            $position = &$data;

            foreach ($keys as $key) {
                if (is_callable($key)) {
                    $value = $key($row);
                } else {
                    $value = $row[$key];
                }

                if (!array_key_exists($value, $position)) {
                    $position[$value] = [];
                }
                $position = &$position[$value];
            }

            $position[] = $row;
            unset($position);
        }

        return $data;
    }
public function groupBy ( ... $ keys ) { $ data = [ ] ; while ( $ row = $ this -> getNextRow ( ) ) { $ position = & $ data ; foreach ( $ keys as $ key ) { if ( is_callable ( $ key ) ) { $ value = $ key ( $ row ) ; } else { $ value = $ row [ $ key ] ; } if ( ! array_key_exists ( $ value , $ position ) ) { $ position [ $ value ] = [ ] ; } $ position = & $ position [ $ value ] ; } $ position [ ] = $ row ; unset ( $ position ) ; } return $ data ; }
Create an array keyed by the specified field.

@return array
Create an array keyed by the specified field .