Skip to content

Commit

Permalink
Fixed VideoAdapter, UrlSlugAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Jan 15, 2025
1 parent 1c0b2c3 commit 3c449f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
14 changes: 4 additions & 10 deletions src/DataObject/Data/Adapter/UrlSlugAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/DataObject/Data/Adapter/VideoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 3c449f9

Please sign in to comment.