From d49098cab62a281fb440914b6f02b0db8bfd6be5 Mon Sep 17 00:00:00 2001 From: Marco Perberschlager Date: Tue, 14 May 2024 09:15:13 +0200 Subject: [PATCH] 156 Integrated DataExtractor service into hydrator --- config/dependencies.yaml | 5 +- .../Extractor/DependencyDataExtractor.php | 46 ------------------- .../DependencyDataExtractorInterface.php | 25 ---------- .../Hydrator/DependencyHydrator.php | 23 ++++++++-- 4 files changed, 21 insertions(+), 78 deletions(-) delete mode 100644 src/Dependency/Extractor/DependencyDataExtractor.php delete mode 100644 src/Dependency/Extractor/DependencyDataExtractorInterface.php diff --git a/config/dependencies.yaml b/config/dependencies.yaml index 825bcb2e7..70ab6cd09 100644 --- a/config/dependencies.yaml +++ b/config/dependencies.yaml @@ -18,7 +18,4 @@ services: class: Pimcore\Bundle\StudioBackendBundle\Dependency\Service\DependencyHydratorService Pimcore\Bundle\StudioBackendBundle\Dependency\Hydrator\DependencyHydratorInterface: - class: Pimcore\Bundle\StudioBackendBundle\Dependency\Hydrator\DependencyHydrator - - Pimcore\Bundle\StudioBackendBundle\Dependency\Extractor\DependencyDataExtractorInterface: - class: Pimcore\Bundle\StudioBackendBundle\Dependency\Extractor\DependencyDataExtractor \ No newline at end of file + class: Pimcore\Bundle\StudioBackendBundle\Dependency\Hydrator\DependencyHydrator \ No newline at end of file diff --git a/src/Dependency/Extractor/DependencyDataExtractor.php b/src/Dependency/Extractor/DependencyDataExtractor.php deleted file mode 100644 index b85330a89..000000000 --- a/src/Dependency/Extractor/DependencyDataExtractor.php +++ /dev/null @@ -1,46 +0,0 @@ -getElement($this->serviceResolver, $elementType, $elementId); - - return [ - 'id' => $element->getId(), - 'type' => $this->serviceResolver->getElementType($element), - 'subtype' => $element->getType(), - 'published' => $this->serviceResolver->isPublished($element), - 'path' => $element->getRealFullPath(), - ]; - } -} \ No newline at end of file diff --git a/src/Dependency/Extractor/DependencyDataExtractorInterface.php b/src/Dependency/Extractor/DependencyDataExtractorInterface.php deleted file mode 100644 index 2c88b3b4b..000000000 --- a/src/Dependency/Extractor/DependencyDataExtractorInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -dataExtractor->extractData($elementType, $elementId); + $data = $this->extractData($elementType, $elementId); return new Dependency( $data['id'], @@ -48,4 +52,17 @@ public function hydrate(array $dependency): ?Dependency $data['published'] ); } + + private function extractData(string $elementType, int $elementId): array + { + $element = $this->getElement($this->serviceResolver, $elementType, $elementId); + + return [ + 'id' => $element->getId(), + 'type' => $this->serviceResolver->getElementType($element), + 'subtype' => $element->getType(), + 'published' => $this->serviceResolver->isPublished($element), + 'path' => $element->getRealFullPath(), + ]; + } } \ No newline at end of file