- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
35 lines
739 B
PHP
35 lines
739 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Database\Metadata;
|
|
|
|
final class MetadataRegistry
|
|
{
|
|
private array $metadata = [];
|
|
|
|
public function __construct(
|
|
private readonly MetadataExtractor $extractor
|
|
) {
|
|
}
|
|
|
|
public function getMetadata(string $entityClass): EntityMetadata
|
|
{
|
|
if (! isset($this->metadata[$entityClass])) {
|
|
$this->metadata[$entityClass] = $this->extractor->extractMetadata($entityClass);
|
|
}
|
|
|
|
return $this->metadata[$entityClass];
|
|
}
|
|
|
|
public function hasMetadata(string $entityClass): bool
|
|
{
|
|
return isset($this->metadata[$entityClass]);
|
|
}
|
|
|
|
public function clearCache(): void
|
|
{
|
|
$this->metadata = [];
|
|
}
|
|
}
|