public function addGroupBy($field)
    {
        $alias = self::DEFAULT_TABLE_ALIAS;
        if (strpos($field, '.') > 0) {
            //monta os joins
            $newAliasField = $this->associationQueryFields($field);
        }
        if (count($this->queryFields) > 0) {
            foreach ($this->queryFields as $item) {
                $parts = [];
                if (strpos($item, ' AS ')) {
                    $item = str_replace(')', '', str_replace('(', '', $item));
                    $parts = explode('AS', $item);
                    $item = trim($parts[0]);
                }
                if (!in_array($item, $this->groupFields)) {
                    $this->queryBuilder->addGroupBy($item);
                    $this->groupFields[] = $item;
                }
            }
        }

        return $this;
    }
public function addGroupBy($field)
    {
        $alias = self::DEFAULT_TABLE_ALIAS;
        if (strpos($field, '.') > 0) {
            //monta os joins
            $newAliasField = $this->associationQueryFields($field);
        }
        if (count($this->queryFields) > 0) {
            foreach ($this->queryFields as $item) {
                $parts = [];
                if (strpos($item, ' AS ')) {
                    $item = str_replace(')', '', str_replace('(', '', $item));
                    $parts = explode('AS', $item);
                    $item = trim($parts[0]);
                }
                if (!in_array($item, $this->groupFields)) {
                    $this->queryBuilder->addGroupBy($item);
                    $this->groupFields[] = $item;
                }
            }
        }

        return $this;
    }
public function addGroupBy ( $ field ) { $ alias = self :: DEFAULT_TABLE_ALIAS ; if ( strpos ( $ field , '.' ) > 0 ) { //monta os joins $ newAliasField = $ this -> associationQueryFields ( $ field ) ; } if ( count ( $ this -> queryFields ) > 0 ) { foreach ( $ this -> queryFields as $ item ) { $ parts = [ ] ; if ( strpos ( $ item , ' AS ' ) ) { $ item = str_replace ( ')' , '' , str_replace ( '(' , '' , $ item ) ) ; $ parts = explode ( 'AS' , $ item ) ; $ item = trim ( $ parts [ 0 ] ) ; } if ( ! in_array ( $ item , $ this -> groupFields ) ) { $ this -> queryBuilder -> addGroupBy ( $ item ) ; $ this -> groupFields [ ] = $ item ; } } } return $ this ; }
Add a "group by" key.

@param string $field
Add a group by key .