diff --git a/src/DataObject/Data/Adapter/AdvancedManyToManyObjectRelationAdapter.php b/src/DataObject/Data/Adapter/AdvancedManyToManyObjectRelationAdapter.php index 308e30e5..ae5ca460 100644 --- a/src/DataObject/Data/Adapter/AdvancedManyToManyObjectRelationAdapter.php +++ b/src/DataObject/Data/Adapter/AdvancedManyToManyObjectRelationAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ConcreteObjectResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/AdvancedManyToManyRelationAdapter.php b/src/DataObject/Data/Adapter/AdvancedManyToManyRelationAdapter.php index baee6397..9764a3b7 100644 --- a/src/DataObject/Data/Adapter/AdvancedManyToManyRelationAdapter.php +++ b/src/DataObject/Data/Adapter/AdvancedManyToManyRelationAdapter.php @@ -18,7 +18,7 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\Element\ServiceResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Util\Trait\ElementProviderTrait; diff --git a/src/DataObject/Data/Adapter/BlockAdapter.php b/src/DataObject/Data/Adapter/BlockAdapter.php index c6ed0939..0b3599ba 100644 --- a/src/DataObject/Data/Adapter/BlockAdapter.php +++ b/src/DataObject/Data/Adapter/BlockAdapter.php @@ -18,7 +18,7 @@ use Exception; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; @@ -85,7 +85,7 @@ public function normalize( /** @var BlockElement $fieldValue */ foreach ($block as $key => $fieldValue) { $blockDefinition = $fieldDefinitions[$key]; - $resultItems[$key] = $this->dataService->getNormalizedValue( + $resultItem[$key] = $this->dataService->getNormalizedValue( $fieldValue->getData(), $blockDefinition, ); diff --git a/src/DataObject/Data/Adapter/BooleanAdapter.php b/src/DataObject/Data/Adapter/BooleanAdapter.php index fe4577e5..6b9ab8b9 100644 --- a/src/DataObject/Data/Adapter/BooleanAdapter.php +++ b/src/DataObject/Data/Adapter/BooleanAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/CalculatedValueAdapter.php b/src/DataObject/Data/Adapter/CalculatedValueAdapter.php index 116a0070..0e85d514 100644 --- a/src/DataObject/Data/Adapter/CalculatedValueAdapter.php +++ b/src/DataObject/Data/Adapter/CalculatedValueAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/CheckboxAdapter.php b/src/DataObject/Data/Adapter/CheckboxAdapter.php index b8be6a3e..e2827d28 100644 --- a/src/DataObject/Data/Adapter/CheckboxAdapter.php +++ b/src/DataObject/Data/Adapter/CheckboxAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/ClassificationStoreAdapter.php b/src/DataObject/Data/Adapter/ClassificationStoreAdapter.php index 6d37d966..d13ce368 100644 --- a/src/DataObject/Data/Adapter/ClassificationStoreAdapter.php +++ b/src/DataObject/Data/Adapter/ClassificationStoreAdapter.php @@ -23,7 +23,7 @@ use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassificationStore\GroupConfigResolverInterface; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassificationStore\ServiceResolverInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; diff --git a/src/DataObject/Data/Adapter/ConsentAdapter.php b/src/DataObject/Data/Adapter/ConsentAdapter.php index 75b160aa..6d546b98 100644 --- a/src/DataObject/Data/Adapter/ConsentAdapter.php +++ b/src/DataObject/Data/Adapter/ConsentAdapter.php @@ -17,7 +17,9 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Exception; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\ConsentData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\DataObject\Consent\Service; @@ -30,7 +32,7 @@ * @internal */ #[AutoconfigureTag(DataAdapterLoaderInterface::ADAPTER_TAG)] -final readonly class ConsentAdapter implements SetterDataInterface +final readonly class ConsentAdapter implements SetterDataInterface, DataNormalizerInterface { public function __construct( private Service $service @@ -76,4 +78,19 @@ public function getDataForSetter( return new Consent($value, $noteId); } + + public function normalize( + mixed $value, + Data $fieldDefinition + ): ?ConsentData { + if (!$value instanceof Consent) { + return null; + } + + return new ConsentData( + $value->getConsent(), + $value->getNoteId(), + $value->getSummaryString(), + ); + } } diff --git a/src/DataObject/Data/Adapter/DateAdapter.php b/src/DataObject/Data/Adapter/DateAdapter.php index c251c8ad..57cf688e 100644 --- a/src/DataObject/Data/Adapter/DateAdapter.php +++ b/src/DataObject/Data/Adapter/DateAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Carbon\Carbon; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/DateRangeAdapter.php b/src/DataObject/Data/Adapter/DateRangeAdapter.php index 08bd982b..8cdfbabe 100644 --- a/src/DataObject/Data/Adapter/DateRangeAdapter.php +++ b/src/DataObject/Data/Adapter/DateRangeAdapter.php @@ -18,7 +18,7 @@ use Carbon\Carbon; use Carbon\CarbonPeriod; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/EncryptedFieldAdapter.php b/src/DataObject/Data/Adapter/EncryptedFieldAdapter.php index 445772f6..c150709c 100644 --- a/src/DataObject/Data/Adapter/EncryptedFieldAdapter.php +++ b/src/DataObject/Data/Adapter/EncryptedFieldAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; diff --git a/src/DataObject/Data/Adapter/ExternalImageAdapter.php b/src/DataObject/Data/Adapter/ExternalImageAdapter.php index bfc7bc92..7d801bd4 100644 --- a/src/DataObject/Data/Adapter/ExternalImageAdapter.php +++ b/src/DataObject/Data/Adapter/ExternalImageAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/FieldCollectionsAdapter.php b/src/DataObject/Data/Adapter/FieldCollectionsAdapter.php index 155b203c..434e0276 100644 --- a/src/DataObject/Data/Adapter/FieldCollectionsAdapter.php +++ b/src/DataObject/Data/Adapter/FieldCollectionsAdapter.php @@ -19,7 +19,7 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; @@ -41,6 +41,10 @@ { use ValidateFieldTypeTrait; + private const TYPE_KEY = 'type'; + + private const DATA_KEY = 'data'; + public function __construct( private DataAdapterServiceInterface $dataAdapterService, private DataServiceInterface $dataService, @@ -72,7 +76,7 @@ public function getDataForSetter( $collection = $this->createCollection( $element, $fieldDefinition, - $collectionRaw['type'], + $collectionRaw[self::TYPE_KEY], $collectionData, $count ); @@ -100,15 +104,13 @@ public function normalize( if (!$fieldCollectionDefinition) { continue; } - $resultItem = ['type' => $type]; + $resultItem = [self::TYPE_KEY => $type, self::DATA_KEY => []]; foreach ($fieldCollectionDefinition->getFieldDefinitions() as $collectionFieldDefinition) { $getter = 'get' . ucfirst($collectionFieldDefinition->getName()); $value = $item->$getter(); - $resultItem[$collectionFieldDefinition->getName()] = $this->dataService->getNormalizedValue( - $value, - $collectionFieldDefinition, - ); + $resultItem[self::DATA_KEY][$collectionFieldDefinition->getName()] = + $this->dataService->getNormalizedValue($value, $collectionFieldDefinition); } $resultItems[] = $resultItem; diff --git a/src/DataObject/Data/Adapter/GeoBoundsAdapter.php b/src/DataObject/Data/Adapter/GeoBoundsAdapter.php index d9c37566..cb11289d 100644 --- a/src/DataObject/Data/Adapter/GeoBoundsAdapter.php +++ b/src/DataObject/Data/Adapter/GeoBoundsAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/GeoPointAdapter.php b/src/DataObject/Data/Adapter/GeoPointAdapter.php index 3ac69281..ec493522 100644 --- a/src/DataObject/Data/Adapter/GeoPointAdapter.php +++ b/src/DataObject/Data/Adapter/GeoPointAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/GeoPointsAdapter.php b/src/DataObject/Data/Adapter/GeoPointsAdapter.php index 829cde79..82fc7b6e 100644 --- a/src/DataObject/Data/Adapter/GeoPointsAdapter.php +++ b/src/DataObject/Data/Adapter/GeoPointsAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/HotspotImageAdapter.php b/src/DataObject/Data/Adapter/HotspotImageAdapter.php index c2c23a1b..0b9c9a25 100644 --- a/src/DataObject/Data/Adapter/HotspotImageAdapter.php +++ b/src/DataObject/Data/Adapter/HotspotImageAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\Element\ServiceResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; diff --git a/src/DataObject/Data/Adapter/ImageAdapter.php b/src/DataObject/Data/Adapter/ImageAdapter.php index 10076b0d..1e4aee60 100644 --- a/src/DataObject/Data/Adapter/ImageAdapter.php +++ b/src/DataObject/Data/Adapter/ImageAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\Asset\AssetResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Util\Trait\ElementProviderTrait; diff --git a/src/DataObject/Data/Adapter/ImageGalleryAdapter.php b/src/DataObject/Data/Adapter/ImageGalleryAdapter.php index 56d49e21..afbe06d8 100644 --- a/src/DataObject/Data/Adapter/ImageGalleryAdapter.php +++ b/src/DataObject/Data/Adapter/ImageGalleryAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Util\Trait\ElementProviderTrait; diff --git a/src/DataObject/Data/Adapter/InputQuantityValueAdapter.php b/src/DataObject/Data/Adapter/InputQuantityValueAdapter.php index 8052080d..08a019a1 100644 --- a/src/DataObject/Data/Adapter/InputQuantityValueAdapter.php +++ b/src/DataObject/Data/Adapter/InputQuantityValueAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/LinkAdapter.php b/src/DataObject/Data/Adapter/LinkAdapter.php index 08dc7180..84377dcf 100644 --- a/src/DataObject/Data/Adapter/LinkAdapter.php +++ b/src/DataObject/Data/Adapter/LinkAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Exception; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php b/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php index af5c9673..fa2ce28c 100644 --- a/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php +++ b/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php @@ -18,7 +18,7 @@ use Exception; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; diff --git a/src/DataObject/Data/Adapter/ManyToManyObjectRelationAdapter.php b/src/DataObject/Data/Adapter/ManyToManyObjectRelationAdapter.php index ba88a9b4..d65622a1 100644 --- a/src/DataObject/Data/Adapter/ManyToManyObjectRelationAdapter.php +++ b/src/DataObject/Data/Adapter/ManyToManyObjectRelationAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ConcreteObjectResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/ManyToManyRelationAdapter.php b/src/DataObject/Data/Adapter/ManyToManyRelationAdapter.php index 35ab54fe..8c679f8f 100644 --- a/src/DataObject/Data/Adapter/ManyToManyRelationAdapter.php +++ b/src/DataObject/Data/Adapter/ManyToManyRelationAdapter.php @@ -18,8 +18,8 @@ use Pimcore\Bundle\StaticResolverBundle\Models\Element\ServiceResolverInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\RelationData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\RelationData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; @@ -78,7 +78,7 @@ public function normalize( $relation->getId(), $elementType, $this->getSubType($relation), - $relation->getFullPath(), + $relation->getRealFullPath(), $this->getPublished($relation) ); } diff --git a/src/DataObject/Data/Adapter/ManyToOneRelationAdapter.php b/src/DataObject/Data/Adapter/ManyToOneRelationAdapter.php index 0ce6cd90..5a93423b 100644 --- a/src/DataObject/Data/Adapter/ManyToOneRelationAdapter.php +++ b/src/DataObject/Data/Adapter/ManyToOneRelationAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\Element\ServiceResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; diff --git a/src/DataObject/Data/Adapter/MultiSelectAdapter.php b/src/DataObject/Data/Adapter/MultiSelectAdapter.php index ae40c453..b17cd25e 100644 --- a/src/DataObject/Data/Adapter/MultiSelectAdapter.php +++ b/src/DataObject/Data/Adapter/MultiSelectAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/NumericAdapter.php b/src/DataObject/Data/Adapter/NumericAdapter.php index a09632d2..c39c1e26 100644 --- a/src/DataObject/Data/Adapter/NumericAdapter.php +++ b/src/DataObject/Data/Adapter/NumericAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/NumericRangeAdapter.php b/src/DataObject/Data/Adapter/NumericRangeAdapter.php index ad6469ea..d8fc8844 100644 --- a/src/DataObject/Data/Adapter/NumericRangeAdapter.php +++ b/src/DataObject/Data/Adapter/NumericRangeAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/ObjectBricksAdapter.php b/src/DataObject/Data/Adapter/ObjectBricksAdapter.php index c472000f..64a04ae7 100644 --- a/src/DataObject/Data/Adapter/ObjectBricksAdapter.php +++ b/src/DataObject/Data/Adapter/ObjectBricksAdapter.php @@ -19,7 +19,7 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterServiceInterface; diff --git a/src/DataObject/Data/Adapter/QuantityValueAdapter.php b/src/DataObject/Data/Adapter/QuantityValueAdapter.php index 4c510f07..0642013d 100644 --- a/src/DataObject/Data/Adapter/QuantityValueAdapter.php +++ b/src/DataObject/Data/Adapter/QuantityValueAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/QuantityValueRangeAdapter.php b/src/DataObject/Data/Adapter/QuantityValueRangeAdapter.php index da130f3a..502ceb15 100644 --- a/src/DataObject/Data/Adapter/QuantityValueRangeAdapter.php +++ b/src/DataObject/Data/Adapter/QuantityValueRangeAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/ReverseObjectRelationAdapter.php b/src/DataObject/Data/Adapter/ReverseObjectRelationAdapter.php index a0cd40e1..53d9c60d 100644 --- a/src/DataObject/Data/Adapter/ReverseObjectRelationAdapter.php +++ b/src/DataObject/Data/Adapter/ReverseObjectRelationAdapter.php @@ -19,7 +19,7 @@ use Exception; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassDefinitionResolverInterface; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ConcreteObjectResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface; diff --git a/src/DataObject/Data/Adapter/RgbaColorAdapter.php b/src/DataObject/Data/Adapter/RgbaColorAdapter.php index 11e7b6d3..294e15fe 100644 --- a/src/DataObject/Data/Adapter/RgbaColorAdapter.php +++ b/src/DataObject/Data/Adapter/RgbaColorAdapter.php @@ -16,7 +16,8 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; @@ -28,7 +29,7 @@ * @internal */ #[AutoconfigureTag(DataAdapterLoaderInterface::ADAPTER_TAG)] -final readonly class RgbaColorAdapter implements SetterDataInterface +final readonly class RgbaColorAdapter implements SetterDataInterface, DataNormalizerInterface { public function getDataForSetter( Concrete $element, @@ -43,4 +44,15 @@ public function getDataForSetter( return new RgbaColor($r, $g, $b, $a); } + + public function normalize( + mixed $value, + Data $fieldDefinition + ): ?string { + if (!$value instanceof RgbaColor) { + return null; + } + + return $value->getHex(true); + } } diff --git a/src/DataObject/Data/Adapter/SelectAdapter.php b/src/DataObject/Data/Adapter/SelectAdapter.php index 06f7569b..1c31c2fc 100644 --- a/src/DataObject/Data/Adapter/SelectAdapter.php +++ b/src/DataObject/Data/Adapter/SelectAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/SliderAdapter.php b/src/DataObject/Data/Adapter/SliderAdapter.php index eaa7ddd8..d742ae9b 100644 --- a/src/DataObject/Data/Adapter/SliderAdapter.php +++ b/src/DataObject/Data/Adapter/SliderAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/StringAdapter.php b/src/DataObject/Data/Adapter/StringAdapter.php index d49be583..9ec32ca6 100644 --- a/src/DataObject/Data/Adapter/StringAdapter.php +++ b/src/DataObject/Data/Adapter/StringAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\DefaultSetterValueTrait; diff --git a/src/DataObject/Data/Adapter/StructuredTableAdapter.php b/src/DataObject/Data/Adapter/StructuredTableAdapter.php index 7721b4e9..d9ead2bb 100644 --- a/src/DataObject/Data/Adapter/StructuredTableAdapter.php +++ b/src/DataObject/Data/Adapter/StructuredTableAdapter.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/TableAdapter.php b/src/DataObject/Data/Adapter/TableAdapter.php index 5c526378..bfabf655 100644 --- a/src/DataObject/Data/Adapter/TableAdapter.php +++ b/src/DataObject/Data/Adapter/TableAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Exception; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/UrlSlugAdapter.php b/src/DataObject/Data/Adapter/UrlSlugAdapter.php index 996449c1..49a87eac 100644 --- a/src/DataObject/Data/Adapter/UrlSlugAdapter.php +++ b/src/DataObject/Data/Adapter/UrlSlugAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Exception; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; diff --git a/src/DataObject/Data/Adapter/VideoAdapter.php b/src/DataObject/Data/Adapter/VideoAdapter.php index 3f697ed9..fc020d11 100644 --- a/src/DataObject/Data/Adapter/VideoAdapter.php +++ b/src/DataObject/Data/Adapter/VideoAdapter.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Adapter; use Pimcore\Bundle\StaticResolverBundle\Models\Asset\AssetResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\FieldContextData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\SetterDataInterface; use Pimcore\Bundle\StudioBackendBundle\DataObject\Service\DataAdapterLoaderInterface; use Pimcore\Bundle\StudioBackendBundle\Util\Constant\ElementTypes; diff --git a/src/DataObject/Data/ClassData.php b/src/DataObject/Data/Model/ClassData.php similarity index 94% rename from src/DataObject/Data/ClassData.php rename to src/DataObject/Data/Model/ClassData.php index 4ca473a7..376bf2c5 100644 --- a/src/DataObject/Data/ClassData.php +++ b/src/DataObject/Data/Model/ClassData.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data; +namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model; /** * @internal diff --git a/src/DataObject/Data/Model/ConsentData.php b/src/DataObject/Data/Model/ConsentData.php new file mode 100644 index 00000000..4aaa66b9 --- /dev/null +++ b/src/DataObject/Data/Model/ConsentData.php @@ -0,0 +1,45 @@ +consent; + } + + public function getNoteId(): ?int + { + return $this->noteId; + } + + public function getNoteContent(): string + { + return $this->noteContent; + } +} diff --git a/src/DataObject/Data/FieldContextData.php b/src/DataObject/Data/Model/FieldContextData.php similarity index 96% rename from src/DataObject/Data/FieldContextData.php rename to src/DataObject/Data/Model/FieldContextData.php index cb1b2d18..519431d0 100644 --- a/src/DataObject/Data/FieldContextData.php +++ b/src/DataObject/Data/Model/FieldContextData.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data; +namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model; use Pimcore\Model\DataObject\Data\BlockElement; use Pimcore\Model\DataObject\Fieldcollection; diff --git a/src/DataObject/Data/RelationData.php b/src/DataObject/Data/Model/RelationData.php similarity index 94% rename from src/DataObject/Data/RelationData.php rename to src/DataObject/Data/Model/RelationData.php index 97e3297f..58a0097e 100644 --- a/src/DataObject/Data/RelationData.php +++ b/src/DataObject/Data/Model/RelationData.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data; +namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model; /** * @internal diff --git a/src/DataObject/Data/SetterDataInterface.php b/src/DataObject/Data/SetterDataInterface.php index 8183a531..2def3854 100644 --- a/src/DataObject/Data/SetterDataInterface.php +++ b/src/DataObject/Data/SetterDataInterface.php @@ -16,6 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Data; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\FieldContextData; use Pimcore\Model\DataObject\ClassDefinition\Data; use Pimcore\Model\DataObject\Concrete; diff --git a/src/DataObject/Service/DataService.php b/src/DataObject/Service/DataService.php index 8e5a7e50..fee605de 100644 --- a/src/DataObject/Service/DataService.php +++ b/src/DataObject/Service/DataService.php @@ -17,8 +17,8 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Service; use Exception; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\ClassData; use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\DataNormalizerInterface; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\ClassData; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Model\DataObject\ClassDefinition\Data; use Pimcore\Model\DataObject\Concrete; diff --git a/src/DataObject/Service/DataServiceInterface.php b/src/DataObject/Service/DataServiceInterface.php index 8ebc53b6..61949666 100644 --- a/src/DataObject/Service/DataServiceInterface.php +++ b/src/DataObject/Service/DataServiceInterface.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataObject\Service; -use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\ClassData; +use Pimcore\Bundle\StudioBackendBundle\DataObject\Data\Model\ClassData; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Model\DataObject\ClassDefinition\Data; use Pimcore\Model\DataObject\Concrete;