
Cakephp2でのORMはIN句を明記しなくても、カラムに配列を渡すとIN句として振る舞ってくれていました。
逆にCakephp4ではIN句は明記する形になります。
例えば、Cakephp2では以下のようなコード
public $months = ['2022-06', '2022-07'];
public function hoge($id, $months)
{
$query = $this->find('all', [
'conditions' => [
'id' => $id,
'month' => $months,
],
]);
}
Cakephp4ではIN句を明記する必要があります。
public $months = ['2022-06', '2022-07'];
public function hoge($id, $months)
{
$query = $this->find('all', [
'conditions' => [
'id' => $id,
'month IN' => $months,
],
]);
}