cakephp 3.0如何select所有至少有一个出价的订单?

How to select all orders for which there is at least one bid cakephp 3.0?

有2个tabletable是通过外键链接的一对多关系

table orders

和tablebids

需要select 所有至少有一个出价的订单。 SQL 这个查询并不难

SELECT * , count(bids.order_id) AS count_bid    
FROM orders
LEFT JOIN bids ON bids.order_id = orders.id
GROUP BY orders.id
HAVING (count_bid > 0)

但需要使用 cakephp 3.0 查询生成器

例如:

$query = $this->Articles->find();
$query
  ->select(['count_bid' => $query->func()->count('Comments.id')])
  ->leftJoinWith('Comments')
  ->group(['Articles.id'])
  ->having(['count_bid >' => 0])
  ->enableAutoFields(true);
$results = $query->toArray();