/**
* @param array<string, CriteriaCollection> $criteriaCollections
*
* @return array{0: array<string, array<string>>, 1: array<string, array<string, Criteria>>}
*/
private function optimizeCriteriaObjects(array
$criteriaCollections): array
{ $directReads =
[];
$searches =
[];
$criteriaCollection =
$this->
flattenCriteriaCollections($criteriaCollections);
foreach ($criteriaCollection as $definition =>
$criteriaObjects) { $directReads[$definition] =
[[]];
$searches[$definition] =
[];
foreach ($criteriaObjects as $criteria) { if ($this->
canBeMerged($criteria)) { $directReads[$definition][] =
$criteria->
getIds();
} else { $criteriaHash =
$this->
hash($criteria);
$criteria->
addExtension('criteriaHash',
new ArrayEntity(['hash' =>
$criteriaHash]));