Hello!
In my case I have a helper method which returns a query builder object for some base parameters. And using it like this:
...
      // standart query
      $items = $this->getQueryBuilder($query)
        ->getQuery()
        ->execute($params);
      // getting count of items with some query modifier
      $total = $this->getQueryBuilder(array_merge($query, ['freshOnly' => false]))
        ->columns('COUNT(*)')
        ->getQuery()
        ->execute($params);
...     What the best way to get int result of COUNT(*)
UPD: Needed analogue of this: www.yiiframework.com/doc-2.0/yii-db-query.html#column()-detail
Executes the query and returns the first column of the result.
Thank you!