protected function doLoadChoicesForValues(array
$values, ?callable
$value): array
{ if ($this->idReader && null ===
$value) { throw new LogicException('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.'
);
} $idReader = null;
if (\
is_array($value) &&
$value[0
] instanceof IdReader
) { $idReader =
$value[0
];
} elseif ($value instanceof \Closure
&& ($rThis =
(new \
ReflectionFunction($value))->
getClosureThis()) instanceof IdReader
) { $idReader =
$rThis;
} // Optimize performance in case we have an object loader and
// a single-field identifier
if ($idReader &&
$this->objectLoader
) { $objects =
[];
$objectsById =
[];
// Maintain order and indices from the given $values
// An alternative approach to the following loop is to add the