$subQuery = (new Query)->select('COUNT(*)')->from('user');
$query = (new Query)->select(['id', 'count' => $subQuery])->from('post');
// $query represents the following SQL:
// SELECT `id`, (SELECT COUNT(*) FROM `user`) AS `count` FROM `post`
SELECT `id`, (SELECT COUNT(*) FROM `user` WHERE `user`.`id`=`post`.`autor_id`) AS `count` FROM `post`
SELECT `post`.`id`, COUNT(`user`.`id`) AS `count`
FROM `post`
LEFT JOIN `user` ON `user`.`id` = `post`.`autor_id`
GROUP BY `post`.`id`
$query = (new Query)
->select(['post.id', 'count' => 'COUNT(user.id)'])
->from('post')
->leftJoin('user', 'user.id = post.autor_id');
->groupBy(['post.id']);