From c49915d2385df78e2b85390d8f7b628eaefbc873 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Thu, 28 Nov 2024 09:28:36 +0100 Subject: [PATCH 01/13] Fix Return Type. --- .../FieldCollection/LayoutDefinitionServiceInterface.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php index d8ea9c67..5c3a6c4d 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php @@ -17,6 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Service\FieldCollection; use Exception; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; /** @@ -26,6 +27,7 @@ interface LayoutDefinitionServiceInterface { /** * @throws NotFoundException|Exception + * @return LayoutDefinition[] */ public function getLayoutDefinitionsForObject(int $dataObjectId): array; } From 085b90f09e1915d6dbaa25874530ac06b837acad Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:20:34 +0100 Subject: [PATCH 02/13] Get Layout Definition for Object Bricks. --- config/class.yaml | 8 +- .../FieldCollection/LayoutController.php | 2 +- .../ObjectBrick/LayoutController.php | 82 ++++++++++++ .../FieldCollection/LayoutDefinitionEvent.php | 2 +- .../ObjectBrick/LayoutDefinitionEvent.php | 35 +++++ .../LayoutDefinitionHydrator.php | 2 +- .../LayoutDefinitionHydratorInterface.php | 2 +- .../ObjectBrick/LayoutDefinitionHydrator.php | 45 +++++++ .../LayoutDefinitionHydratorInterface.php | 28 ++++ .../LayoutDefinition.php | 2 +- .../Schema/ObjectBrick/LayoutDefinition.php | 126 ++++++++++++++++++ .../LayoutDefinitionService.php | 2 +- .../LayoutDefinitionServiceInterface.php | 2 +- .../ObjectBrick/LayoutDefinitionService.php | 97 ++++++++++++++ .../LayoutDefinitionServiceInterface.php | 31 +++++ 15 files changed, 458 insertions(+), 8 deletions(-) create mode 100644 src/Class/Controller/ObjectBrick/LayoutController.php create mode 100644 src/Class/Event/ObjectBrick/LayoutDefinitionEvent.php create mode 100644 src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydrator.php create mode 100644 src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydratorInterface.php rename src/Class/Schema/{ => FieldCollection}/LayoutDefinition.php (97%) create mode 100644 src/Class/Schema/ObjectBrick/LayoutDefinition.php create mode 100644 src/Class/Service/ObjectBrick/LayoutDefinitionService.php create mode 100644 src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php diff --git a/config/class.yaml b/config/class.yaml index e818c5e5..3cd25c3c 100644 --- a/config/class.yaml +++ b/config/class.yaml @@ -17,6 +17,9 @@ services: Pimcore\Bundle\StudioBackendBundle\Class\Service\FieldCollection\LayoutDefinitionServiceInterface: class: Pimcore\Bundle\StudioBackendBundle\Class\Service\FieldCollection\LayoutDefinitionService + Pimcore\Bundle\StudioBackendBundle\Class\Service\ObjectBrick\LayoutDefinitionServiceInterface: + class: Pimcore\Bundle\StudioBackendBundle\Class\Service\ObjectBrick\LayoutDefinitionService + Pimcore\Bundle\StudioBackendBundle\Class\Repository\QuantityValueRepositoryInterface: class: Pimcore\Bundle\StudioBackendBundle\Class\Repository\QuantityValueRepository @@ -27,4 +30,7 @@ services: # Hydrators # Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface: - class: Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydrator \ No newline at end of file + class: Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydrator + + Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydratorInterface: + class: Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydrator \ No newline at end of file diff --git a/src/Class/Controller/FieldCollection/LayoutController.php b/src/Class/Controller/FieldCollection/LayoutController.php index 64bd5e2f..2bc9ef84 100644 --- a/src/Class/Controller/FieldCollection/LayoutController.php +++ b/src/Class/Controller/FieldCollection/LayoutController.php @@ -18,7 +18,7 @@ use Exception; use OpenApi\Attributes\Get; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Class\Service\FieldCollection\LayoutDefinitionServiceInterface; use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; diff --git a/src/Class/Controller/ObjectBrick/LayoutController.php b/src/Class/Controller/ObjectBrick/LayoutController.php new file mode 100644 index 00000000..65a612e1 --- /dev/null +++ b/src/Class/Controller/ObjectBrick/LayoutController.php @@ -0,0 +1,82 @@ +value], + )] + #[IdParameter(name: 'objectId', required: true)] + #[SuccessResponse( + description: 'class_object_brick_object_layout_success_response', + content: new CollectionJson(new GenericCollection(LayoutDefinition::class)) + )] + #[DefaultResponses([ + HttpResponseCodes::NOT_FOUND, + ])] + public function getObjectBrickLayoutForObject(int $objectId): JsonResponse + { + $items = $this->layoutDefinitionService->getLayoutDefinitionsForObject($objectId); + + return $this->getPaginatedCollection( + $this->serializer, + $items, + count($items), + ); + } +} diff --git a/src/Class/Event/FieldCollection/LayoutDefinitionEvent.php b/src/Class/Event/FieldCollection/LayoutDefinitionEvent.php index 66d41765..ecd63f5d 100644 --- a/src/Class/Event/FieldCollection/LayoutDefinitionEvent.php +++ b/src/Class/Event/FieldCollection/LayoutDefinitionEvent.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Event\FieldCollection; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Event\AbstractPreResponseEvent; final class LayoutDefinitionEvent extends AbstractPreResponseEvent diff --git a/src/Class/Event/ObjectBrick/LayoutDefinitionEvent.php b/src/Class/Event/ObjectBrick/LayoutDefinitionEvent.php new file mode 100644 index 00000000..fe890dc0 --- /dev/null +++ b/src/Class/Event/ObjectBrick/LayoutDefinitionEvent.php @@ -0,0 +1,35 @@ +layoutDefinition); + } + + public function getLayoutDefinition(): LayoutDefinition + { + return $this->layoutDefinition; + } +} diff --git a/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydrator.php b/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydrator.php index ddafa45c..7d9dc940 100644 --- a/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydrator.php +++ b/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydrator.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Model\DataObject\Fieldcollection\Definition as FieldCollectionDefinition; /** diff --git a/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydratorInterface.php b/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydratorInterface.php index f0691955..45a25318 100644 --- a/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydratorInterface.php +++ b/src/Class/Hydrator/FieldCollection/LayoutDefinitionHydratorInterface.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Model\DataObject\Fieldcollection\Definition as FieldCollectionDefinition; /** diff --git a/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydrator.php b/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydrator.php new file mode 100644 index 00000000..7de93ac7 --- /dev/null +++ b/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydrator.php @@ -0,0 +1,45 @@ +getLayoutDefinitions(); + + return new LayoutDefinition( + $data->getKey(), + $layout->getDatatype(), + $layout->getName(), + $layout->getType(), + $layout->getRegion(), + $layout->getTitle(), + $layout->getWidth(), + $layout->getHeight(), + $layout->getCollapsible(), + $layout->getCollapsed(), + $layout->getChildren(), + ); + } +} diff --git a/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydratorInterface.php b/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydratorInterface.php new file mode 100644 index 00000000..789b1e50 --- /dev/null +++ b/src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydratorInterface.php @@ -0,0 +1,28 @@ +key; + } + + public function getName(): ?string + { + return $this->name; + } + + public function getType(): ?string + { + return $this->type; + } + + public function getRegion(): ?string + { + return $this->region; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function getWidth(): int + { + return $this->width; + } + + public function getHeight(): int + { + return $this->height; + } + + public function isCollapsible(): bool + { + return $this->collapsible; + } + + public function isCollapsed(): bool + { + return $this->collapsed; + } + + public function getDatatype(): string + { + return $this->datatype; + } + + public function getChildren(): array + { + return $this->children; + } +} diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionService.php b/src/Class/Service/FieldCollection/LayoutDefinitionService.php index 7aa5b9ad..1d124621 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionService.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionService.php @@ -22,7 +22,7 @@ use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Event\FieldCollection\LayoutDefinitionEvent; use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\Object\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinitionInterface; diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php index 5c3a6c4d..eec4215f 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Service\FieldCollection; use Exception; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; /** diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php new file mode 100644 index 00000000..c5ca1b79 --- /dev/null +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -0,0 +1,97 @@ +dataObjectResolver->getById($dataObjectId); + + $classDef = $this->classDefinitionResolver->getById($dataObject->getClassId()); + + $this->collectFieldCollectionTypes($classDef); + + $layoutDefinitions = []; + foreach ($this->objectBrickTypes as $type) { + $layoutDefinitions[] = $this->getLayoutDefinitionByType($type); + } + + return $layoutDefinitions; + + } + + /** + * @throws Exception + */ + private function getLayoutDefinitionByType(string $name): LayoutDefinition + { + $definition = $this->definitionResolver->getByKey($name); + + if (!$definition) { + throw new NotFoundException('Object Brick Definition', $name); + } + + $layoutDefinition = $this->layoutDefinitionHydrator->hydrate($definition); + + $this->eventDispatcher->dispatch( + new LayoutDefinitionEvent($layoutDefinition), + LayoutDefinitionEvent::EVENT_NAME + ); + + return $layoutDefinition; + } + + private function collectFieldCollectionTypes(ClassDefinitionInterface $classDefinition): void + { + foreach ($classDefinition->getFieldDefinitions() as $fieldDefinition) { + if ($fieldDefinition instanceof DataObject\ClassDefinition\Data\Objectbricks) { + $this->objectBrickTypes = [...$this->objectBrickTypes, ...$fieldDefinition->getAllowedTypes()]; + } + } + } + +} diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php new file mode 100644 index 00000000..b89b887d --- /dev/null +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php @@ -0,0 +1,31 @@ + Date: Mon, 2 Dec 2024 08:40:26 +0100 Subject: [PATCH 03/13] Add translation. --- translations/studio_api_docs.en.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/translations/studio_api_docs.en.yaml b/translations/studio_api_docs.en.yaml index 193ba08c..1664c9fa 100644 --- a/translations/studio_api_docs.en.yaml +++ b/translations/studio_api_docs.en.yaml @@ -605,6 +605,10 @@ class_field_collection_object_layout_description: | Get all layouts from the field collection for an given object class_field_collection_object_layout_summary: Get all layouts from the field collection for an given object class_field_collection_object_layout_success_response: List of layouts +class_object_brick_object_layout_description: | + Get all layouts from the object bricks for an given object +class_object_brick_object_layout_summary: Get all layouts from the object bricks for an given object +class_object_brick_object_layout_success_response: List of layouts class_quantity_value_unit_list_description: | List of available quantity value units class_quantity_value_unit_list_summary: List of available quantity value units From da3d3f0227e0fc862a28b237fa774e017b323dde Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:40:43 +0100 Subject: [PATCH 04/13] Fix schema --- src/Class/Controller/ObjectBrick/LayoutController.php | 2 +- src/Class/Schema/FieldCollection/LayoutDefinition.php | 1 + src/Class/Schema/ObjectBrick/LayoutDefinition.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Class/Controller/ObjectBrick/LayoutController.php b/src/Class/Controller/ObjectBrick/LayoutController.php index 65a612e1..eb210515 100644 --- a/src/Class/Controller/ObjectBrick/LayoutController.php +++ b/src/Class/Controller/ObjectBrick/LayoutController.php @@ -18,7 +18,7 @@ use Exception; use OpenApi\Attributes\Get; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Class\Service\ObjectBrick\LayoutDefinitionServiceInterface; use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; diff --git a/src/Class/Schema/FieldCollection/LayoutDefinition.php b/src/Class/Schema/FieldCollection/LayoutDefinition.php index b25d6fce..d5db6feb 100644 --- a/src/Class/Schema/FieldCollection/LayoutDefinition.php +++ b/src/Class/Schema/FieldCollection/LayoutDefinition.php @@ -26,6 +26,7 @@ * @internal */ #[Schema( + schema: 'FieldCollectionLayoutDefinition', title: 'Field Collection Layout Definition', required: [ 'key', diff --git a/src/Class/Schema/ObjectBrick/LayoutDefinition.php b/src/Class/Schema/ObjectBrick/LayoutDefinition.php index 44166bf4..42b6a4ed 100644 --- a/src/Class/Schema/ObjectBrick/LayoutDefinition.php +++ b/src/Class/Schema/ObjectBrick/LayoutDefinition.php @@ -26,6 +26,7 @@ * @internal */ #[Schema( + schema: 'ObjectBrickLayoutDefinition', title: 'Object Brick Layout Definition', required: [ 'key', From 20ad90fc6eda3b1fc5be05a6f120e90d85cc0ca6 Mon Sep 17 00:00:00 2001 From: martineiber Date: Mon, 2 Dec 2024 07:42:04 +0000 Subject: [PATCH 05/13] Apply php-cs-fixer changes --- .../Service/FieldCollection/LayoutDefinitionServiceInterface.php | 1 + src/Class/Service/ObjectBrick/LayoutDefinitionService.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php index eec4215f..ccbf8424 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionServiceInterface.php @@ -27,6 +27,7 @@ interface LayoutDefinitionServiceInterface { /** * @throws NotFoundException|Exception + * * @return LayoutDefinition[] */ public function getLayoutDefinitionsForObject(int $dataObjectId): array; diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php index c5ca1b79..689dfa0b 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -93,5 +93,4 @@ private function collectFieldCollectionTypes(ClassDefinitionInterface $classDefi } } } - } From 219fd2ad3dbcfe6361d8d46d96e3d9d426026cf3 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:43:01 +0100 Subject: [PATCH 06/13] Add return type --- .../Service/ObjectBrick/LayoutDefinitionServiceInterface.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php index b89b887d..6fba722e 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php @@ -17,6 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Service\ObjectBrick; use Exception; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; /** @@ -26,6 +27,7 @@ interface LayoutDefinitionServiceInterface { /** * @throws NotFoundException|Exception + * @return LayoutDefinition[] */ public function getLayoutDefinitionsForObject(int $dataObjectId): array; } From 829f278a25dcf2295441239f4bc332e7ab8c8ad0 Mon Sep 17 00:00:00 2001 From: martineiber Date: Mon, 2 Dec 2024 07:43:36 +0000 Subject: [PATCH 07/13] Apply php-cs-fixer changes --- .../Service/ObjectBrick/LayoutDefinitionServiceInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php index 6fba722e..7a03dc47 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionServiceInterface.php @@ -27,6 +27,7 @@ interface LayoutDefinitionServiceInterface { /** * @throws NotFoundException|Exception + * * @return LayoutDefinition[] */ public function getLayoutDefinitionsForObject(int $dataObjectId): array; From e67e0a6c5752a66767d35ee80e762cc70a9bf818 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:45:58 +0100 Subject: [PATCH 08/13] Fix line length. --- src/Class/Service/ObjectBrick/LayoutDefinitionService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php index 689dfa0b..0dccba7f 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -19,7 +19,8 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassDefinitionResolverInterface; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\DataObjectResolverInterface; -use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface as ObjectBrickDefinitionResolverInterface; +use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface + as ObjectBrickDefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Event\ObjectBrick\LayoutDefinitionEvent; use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; From 117c7c243713f9469d0843d8c70922bb891309de Mon Sep 17 00:00:00 2001 From: martineiber Date: Mon, 2 Dec 2024 07:46:38 +0000 Subject: [PATCH 09/13] Apply php-cs-fixer changes --- src/Class/Service/ObjectBrick/LayoutDefinitionService.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php index 0dccba7f..689dfa0b 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -19,8 +19,7 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassDefinitionResolverInterface; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\DataObjectResolverInterface; -use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface - as ObjectBrickDefinitionResolverInterface; +use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface as ObjectBrickDefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Event\ObjectBrick\LayoutDefinitionEvent; use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; From 6f3e2c623e844f3975687f0f376e120f91fb3aeb Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:50:26 +0100 Subject: [PATCH 10/13] Fix return Value. --- src/Class/Service/FieldCollection/LayoutDefinitionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionService.php b/src/Class/Service/FieldCollection/LayoutDefinitionService.php index 1d124621..798a9ec3 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionService.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionService.php @@ -22,7 +22,7 @@ use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Event\FieldCollection\LayoutDefinitionEvent; use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\Object\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinitionInterface; From 501fbef4361b75f3986606330c864166fdf691a6 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 08:58:33 +0100 Subject: [PATCH 11/13] Fix Return Value --- src/Class/Service/FieldCollection/LayoutDefinitionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionService.php b/src/Class/Service/FieldCollection/LayoutDefinitionService.php index 798a9ec3..e5ca7b4a 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionService.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionService.php @@ -22,7 +22,7 @@ use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Event\FieldCollection\LayoutDefinitionEvent; use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; +use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinitionInterface; From 40118efe4b127d6e84ab60136cccead174c77770 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Mon, 2 Dec 2024 09:42:27 +0100 Subject: [PATCH 12/13] Import namespace. --- src/Class/Service/FieldCollection/LayoutDefinitionService.php | 4 ++-- src/Class/Service/ObjectBrick/LayoutDefinitionService.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionService.php b/src/Class/Service/FieldCollection/LayoutDefinitionService.php index e5ca7b4a..77498797 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionService.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionService.php @@ -24,9 +24,9 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; -use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinitionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections; /** * @internal @@ -91,7 +91,7 @@ private function getLayoutDefinitionByType(string $name): LayoutDefinition private function collectFieldCollectionTypes(ClassDefinitionInterface $classDefinition): void { foreach ($classDefinition->getFieldDefinitions() as $fieldDefinition) { - if ($fieldDefinition instanceof DataObject\ClassDefinition\Data\Fieldcollections) { + if ($fieldDefinition instanceof Fieldcollections) { $this->fieldCollectionTypes = [...$this->fieldCollectionTypes, ...$fieldDefinition->getAllowedTypes()]; } } diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php index 689dfa0b..11120029 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -24,9 +24,9 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; -use Pimcore\Model\DataObject; use Pimcore\Model\DataObject\ClassDefinitionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Pimcore\Model\DataObject\ClassDefinition\Data\Objectbricks; /** * @internal @@ -88,7 +88,7 @@ private function getLayoutDefinitionByType(string $name): LayoutDefinition private function collectFieldCollectionTypes(ClassDefinitionInterface $classDefinition): void { foreach ($classDefinition->getFieldDefinitions() as $fieldDefinition) { - if ($fieldDefinition instanceof DataObject\ClassDefinition\Data\Objectbricks) { + if ($fieldDefinition instanceof Objectbricks) { $this->objectBrickTypes = [...$this->objectBrickTypes, ...$fieldDefinition->getAllowedTypes()]; } } From 90370a73fff4bf34c22148f7f003987f90eeed2c Mon Sep 17 00:00:00 2001 From: martineiber Date: Mon, 2 Dec 2024 08:43:04 +0000 Subject: [PATCH 13/13] Apply php-cs-fixer changes --- src/Class/Service/FieldCollection/LayoutDefinitionService.php | 2 +- src/Class/Service/ObjectBrick/LayoutDefinitionService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Class/Service/FieldCollection/LayoutDefinitionService.php b/src/Class/Service/FieldCollection/LayoutDefinitionService.php index 77498797..c382424b 100644 --- a/src/Class/Service/FieldCollection/LayoutDefinitionService.php +++ b/src/Class/Service/FieldCollection/LayoutDefinitionService.php @@ -24,9 +24,9 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\FieldCollection\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\FieldCollection\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; +use Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections; use Pimcore\Model\DataObject\ClassDefinitionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections; /** * @internal diff --git a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php index 11120029..f1906354 100644 --- a/src/Class/Service/ObjectBrick/LayoutDefinitionService.php +++ b/src/Class/Service/ObjectBrick/LayoutDefinitionService.php @@ -24,9 +24,9 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick\LayoutDefinitionHydratorInterface; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; +use Pimcore\Model\DataObject\ClassDefinition\Data\Objectbricks; use Pimcore\Model\DataObject\ClassDefinitionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Pimcore\Model\DataObject\ClassDefinition\Data\Objectbricks; /** * @internal