Skip to content

Commit

Permalink
fix: bug when multiple metadata caches are created
Browse files Browse the repository at this point in the history
  • Loading branch information
bednic committed Aug 31, 2020
1 parent 7d1908d commit fa22e78
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Metadata/MetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ private function getAllMetadata(): array
*/
private function load(): void
{
$cacheKey = get_class($this);
try {
if ($this->cache->has(slashToDot(self::class))) {
foreach ($this->cache->get(slashToDot(self::class)) as $className) {
if ($this->cache->has(slashToDot($cacheKey))) {
foreach ($this->cache->get(slashToDot($cacheKey)) as $className) {
$this->loadMetadata($className);
}
} else {
Expand Down Expand Up @@ -182,7 +183,7 @@ private function createMetadataCache(): void
}
}
try {
$this->cache->set(slashToDot(self::class), array_keys($this->metadata));
$this->cache->set(slashToDot(get_class($this)), array_keys($this->metadata));
} catch (CacheException $ignored) {
// NO SONAR
}
Expand Down

0 comments on commit fa22e78

Please sign in to comment.