Mismatched/wrong 使用 notMatching 和 where 查询参数

Mismatched/wrong query parameters using notMatching and where

我将查询生成器的 notMatching 函数与标准 where 结合使用时出现了奇怪的行为。 OR/AND 数组中给出的参数似乎不匹配(更准确地说,它似乎采用最后一个并将其用于前最后一个)。

这是我的查询:

$myModel
->find('list')
->where(['column' => 'a value to match']) // If I remove the entire line it works
->notMatching('AnotherModel', function ($query) use ($value, $anotherValue) {
    return $query->where([
        'OR' => [
            ['secondColumn >=' => $value],
            ['secondColumn <=' => $value]
        ],
        'thirdColumn' => $anotherValue
    ]);
});

这里是生成的SQL(简体):

`column` = `a value to match`
AND (
  `MyModel`.`id` NOT IN (
    SELECT 
      ...
    FROM 
      ... 
    WHERE 
      (
        (
          `secondColumn` >= $value 
          OR `secondColumn` <= $anotherValue /* The issue */
        ) 
        AND `thirdColumn` = $anotherValue
      )
  )
)

如您所见,使用了 $anotherValue 而不是 $value。如果我删除整个第一个 where(在 find 之后),它会正常工作。有趣的是,我没有 matchinginnerJoinWith.

的问题

这似乎已在 CakePHP 版本中修复 3.8.12