function aggregate( $function ) {

        if ( $this->parent_ ) {

            throw new \LogicException( 'Cannot aggregate referenced result' );

        }

        $statement = $this->db->select( $this->table, array(
            'expr' => $function,
            'where' => $this->where,
            'orderBy' => $this->orderBy,
            'limitCount' => $this->limitCount,
            'limitOffset' => $this->limitOffset,
            'params' => $this->whereParams
        ) );

        foreach ( $statement->fetch() as $return ) {

            return $return;

        }

    }
function aggregate( $function ) {

        if ( $this->parent_ ) {

            throw new \LogicException( 'Cannot aggregate referenced result' );

        }

        $statement = $this->db->select( $this->table, array(
            'expr' => $function,
            'where' => $this->where,
            'orderBy' => $this->orderBy,
            'limitCount' => $this->limitCount,
            'limitOffset' => $this->limitOffset,
            'params' => $this->whereParams
        ) );

        foreach ( $statement->fetch() as $return ) {

            return $return;

        }

    }
function aggregate ( $ function ) { if ( $ this -> parent_ ) { throw new \ LogicException ( 'Cannot aggregate referenced result' ) ; } $ statement = $ this -> db -> select ( $ this -> table , array ( 'expr' => $ function , 'where' => $ this -> where , 'orderBy' => $ this -> orderBy , 'limitCount' => $ this -> limitCount , 'limitOffset' => $ this -> limitOffset , 'params' => $ this -> whereParams ) ) ; foreach ( $ statement -> fetch ( ) as $ return ) { return $ return ; } }
Execute aggregate function and return value

@param string $function
@return mixed
Execute aggregate function and return value