diff --git a/src/DataObject/Data/Adapter/UrlSlugAdapter.php b/src/DataObject/Data/Adapter/UrlSlugAdapter.php index 49a87eac..9ce70f56 100644 --- a/src/DataObject/Data/Adapter/UrlSlugAdapter.php +++ b/src/DataObject/Data/Adapter/UrlSlugAdapter.php @@ -48,17 +48,11 @@ public function getDataForSetter( return []; } $result = []; - foreach ($urlData as $slug) { - if ($slug instanceof UrlSlug) { - $siteId = $slug->getSiteId(); - $resultItem = [ - 'slug' => $slug->getSlug(), - 'siteId' => $siteId, - 'domain' => $this->getDomain($siteId), - ]; + foreach ($urlData as $slugData) { + $siteId = $slugData['siteId']; + $slug = $slugData['slug']; - $result[$siteId] = $resultItem; - } + $result[$siteId] = new UrlSlug($slug, $siteId); } return $result; diff --git a/src/DataObject/Data/Adapter/VideoAdapter.php b/src/DataObject/Data/Adapter/VideoAdapter.php index 535c8ba5..5d6cd042 100644 --- a/src/DataObject/Data/Adapter/VideoAdapter.php +++ b/src/DataObject/Data/Adapter/VideoAdapter.php @@ -55,13 +55,12 @@ public function getDataForSetter( return null; } - $adapterData['data'] = $this->resolveAssetIfNeeded($adapterData['type'] ?? null, $adapterData['data']); - if ($adapterData['data'] === null) { - return null; + $type = $adapterData['type'] ?? null; + if($type === ElementTypes::TYPE_ASSET) { + $adapterData['data'] = $this->resolveAssetIfNeeded($type, $adapterData['data']['fullPath']); + $adapterData['poster'] = $this->getAssetByPath($adapterData['poster'] ?? null); } - $adapterData['poster'] = $this->getAssetByPath($adapterData['poster'] ?? null); - return $this->createVideoObject($adapterData); } @@ -100,7 +99,8 @@ public function normalize(mixed $value, Data $fieldDefinition): mixed $data['poster']['fullPath'] = $value->getPoster()?->getRealFullPath(); } - if (isset($data['data'])) { + $type = $data['type'] ?? ''; + if (isset($data['data']) && $type === ElementTypes::TYPE_ASSET) { $data['data']['fullPath'] = $value->getData()?->getRealFullPath(); $data['data']['subtype'] = $value->getData()?->getType(); }