Description
With version 5.7.14 there where some performance optimizations for the whereIn method for relations (noted as "Improved eager loading performance" in the release notes).
This brought a breakage for existing users and this breakage was fixed by workarounds with #26622 and further with #26688.
Currently this workaround uses the optimization and stays compatible with existing apps, by doing the following checking (in Illuminate\Database\Eloquent\Relations\Relation line 320):
protected function whereInMethod(Model $model, $key)
{
return $model->getKeyName() === last(explode('.', $key))
&& $model->getIncrementing()
&& in_array($model->getKeyType(), ['int', 'integer'])
? 'whereIntegerInRaw' // <- the method name optimized for integers
: 'whereIn';
}
My proposal is to remove the check to $model->getIncrementing()
and use the optimization also for integer keys that are not marked for auto incrementation.
As this is a breaking change it should be done for the next big release (5.9 or 6.0) and thus also needs to be documented in the upgrade guide.