| @@ 72-91 (lines=20) @@ | ||
| 69 | $this->loadDataLoader()->prepareOnMetadataLoad($entityManager, $classMetadata); |
|
| 70 | } |
|
| 71 | ||
| 72 | private function loadDataLoader(): DataLoaderInterface |
|
| 73 | { |
|
| 74 | if (is_null($this->loadedDataLoader)) { |
|
| 75 | /** @var object $loadedDataLoader */ |
|
| 76 | $loadedDataLoader = $this->container->get($this->serviceId); |
|
| 77 | ||
| 78 | if ($loadedDataLoader instanceof DataLoaderInterface) { |
|
| 79 | $this->loadedDataLoader = $loadedDataLoader; |
|
| 80 | ||
| 81 | } else { |
|
| 82 | throw new ErrorException(sprintf( |
|
| 83 | "Service with id '%s' must implement %s", |
|
| 84 | $this->serviceId, |
|
| 85 | DataLoaderInterface::class |
|
| 86 | )); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | return $this->loadedDataLoader; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||
| @@ 52-71 (lines=20) @@ | ||
| 49 | $this->loadActualHydrator()->assertHydrationOnEntity($entity, $entityManager); |
|
| 50 | } |
|
| 51 | ||
| 52 | private function loadActualHydrator(): EntityHydratorInterface |
|
| 53 | { |
|
| 54 | if (is_null($this->actualHydrator)) { |
|
| 55 | /** @var object $actualHydrator */ |
|
| 56 | $actualHydrator = $this->container->get($this->serviceId); |
|
| 57 | ||
| 58 | if ($actualHydrator instanceof EntityHydratorInterface) { |
|
| 59 | $this->actualHydrator = $actualHydrator; |
|
| 60 | ||
| 61 | } else { |
|
| 62 | throw new InvalidMappingException(sprintf( |
|
| 63 | "Expected service with id '%s' to be of type %s!", |
|
| 64 | $this->serviceId, |
|
| 65 | EntityHydratorInterface::class |
|
| 66 | )); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | return $this->actualHydrator; |
|
| 71 | } |
|
| 72 | ||
| 73 | } |
|
| 74 | ||
| @@ 80-102 (lines=23) @@ | ||
| 77 | ); |
|
| 78 | } |
|
| 79 | ||
| 80 | private function getInnerValueResolver(): ValueResolverInterface |
|
| 81 | { |
|
| 82 | if (is_null($this->innerValueResolver)) { |
|
| 83 | /** @var mixed $valueResolver */ |
|
| 84 | $valueResolver = $this->container->get($this->serviceId); |
|
| 85 | ||
| 86 | if ($valueResolver instanceof ValueResolverInterface) { |
|
| 87 | $this->innerValueResolver = $valueResolver; |
|
| 88 | } |
|
| 89 | ||
| 90 | if (is_null($this->innerValueResolver)) { |
|
| 91 | throw new ErrorException(sprintf( |
|
| 92 | "Service with id '%s' must implement %s", |
|
| 93 | $this->serviceId, |
|
| 94 | ValueResolverInterface::class |
|
| 95 | )); |
|
| 96 | } |
|
| 97 | } |
|
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | return $this->innerValueResolver; |
|
| 102 | } |
|
| 103 | ||
| 104 | } |
|
| 105 | ||