Refactor to use class_map() instead
This commit is contained in:
parent
bb943afabe
commit
4f28aaa206
@ -113,11 +113,12 @@ class DefaultQueryCache implements QueryCache
|
|||||||
|
|
||||||
$cm = $this->em->getClassMetadata($entityName);
|
$cm = $this->em->getClassMetadata($entityName);
|
||||||
|
|
||||||
$entityCacheKeys = [];
|
$generateKeys = function (array $entry) use ($cm): EntityCacheKey {
|
||||||
foreach ($entry->result as $index => $concreteEntry) {
|
return new EntityCacheKey($cm->rootEntityName, $entry['identifier']);
|
||||||
$entityCacheKeys[$index] = new EntityCacheKey($cm->rootEntityName, $concreteEntry['identifier']);
|
};
|
||||||
}
|
|
||||||
$entries = $region->getMultiple(new CollectionCacheEntry($entityCacheKeys));
|
$cacheKeys = new CollectionCacheEntry(array_map($generateKeys, $entry->result));
|
||||||
|
$entries = $region->getMultiple($cacheKeys);
|
||||||
|
|
||||||
// @TODO - move to cache hydration component
|
// @TODO - move to cache hydration component
|
||||||
foreach ($entry->result as $index => $entry) {
|
foreach ($entry->result as $index => $entry) {
|
||||||
@ -127,14 +128,14 @@ class DefaultQueryCache implements QueryCache
|
|||||||
if ($entityEntry === null) {
|
if ($entityEntry === null) {
|
||||||
|
|
||||||
if ($this->cacheLogger !== null) {
|
if ($this->cacheLogger !== null) {
|
||||||
$this->cacheLogger->entityCacheMiss($regionName, $entityCacheKeys[$index]);
|
$this->cacheLogger->entityCacheMiss($regionName, $cacheKeys->identifiers[$index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->cacheLogger !== null) {
|
if ($this->cacheLogger !== null) {
|
||||||
$this->cacheLogger->entityCacheHit($regionName, $entityCacheKeys[$index]);
|
$this->cacheLogger->entityCacheHit($regionName, $cacheKeys->identifiers[$index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $hasRelation) {
|
if ( ! $hasRelation) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user