私は属しているの関連付けを持っていPriceますSeason
シーズンに渡されたときに特定の日付範囲に一致するすべての価格と、一致しないすべての価格を照会しようとしています ( Prices.season_id=0)
ここに私が持っているものがあります:
// build the query
$query = $this->Prices->find()
  ->where(['product_id'=>$q['product_id']])
  ->contain(['Seasons']);
if(!empty($to_date) && !empty($from_date)) {
  $query->matching('Seasons', function ($q) {
    return $q->where([
      'from_date <= ' => $to_date,
      'to_date >= ' => $from_date
    ]);
  });
}
ただし、これは Season に明示的に関連付けられた Price のみを返します。Price.season_id=0 も返すようにするにはどうすればよいですか?