field loading

This commit is contained in:
Yuri Kuznetsov
2021-04-26 13:47:35 +03:00
parent 87a34f2fbb
commit f320ef4721
7 changed files with 308 additions and 135 deletions
@@ -45,6 +45,8 @@ class GeneralLoadProcessor
private $metadata;
private $processorListMapCache = [];
public function __construct(InjectableFactory $injectableFactory, Metadata $metadata)
{
$this->injectableFactory = $injectableFactory;
@@ -53,7 +55,7 @@ class GeneralLoadProcessor
public function process(Entity $entity): void
{
foreach ($this->createProcessorList($entity->getEntityType()) as $processor) {
foreach ($this->getProcessorList($entity->getEntityType()) as $processor) {
$processor->process($entity);
}
}
@@ -61,14 +63,20 @@ class GeneralLoadProcessor
/**
* @return LoadProcessor[]
*/
private function createProcessorList(string $entityType): array
private function getProcessorList(string $entityType): array
{
if (array_key_exists($entityType, $this->processorListMapCache)) {
return $this->processorListMapCache[$entityType];
}
$list = [];
foreach ($this->getProcessorClassNameList($entityType) as $className) {
$list[] = $this->createProcessor($className);
}
$this->processorListMapCache[$entityType] = $list;
return $list;
}