Skip to content

Commit

Permalink
Fix ProductSaleElementImage not transformed to api model before seria…
Browse files Browse the repository at this point in the history
…lization
  • Loading branch information
lopes-vincent committed Dec 27, 2023
1 parent 0b76b8d commit ac682c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.0.8</version>
<version>2.0.9</version>
<authors>
<author>
<name>Michaël Espeche</name>
Expand Down
13 changes: 10 additions & 3 deletions Model/Api/WishListPse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

use OpenApi\Annotations as OA;
use OpenApi\Model\Api\BaseApiModel;
use OpenApi\Model\Api\Image;
use OpenApi\Model\Api\ModelTrait\translatable;
use OpenApi\Model\Api\ProductSaleElement;
use Thelia\Model\ProductSaleElements;
use Thelia\Model\ProductSaleElementsProductImage;


/**
Expand Down Expand Up @@ -63,6 +64,12 @@ public function createFromTheliaModel($theliaModel, $locale = null)
$this->setMetaKeywords($product->getMetaKeywords());

$images = $theliaModel->getProductSaleElementsProductImages();
$this->setImages($images->getData());
$images = array_map(
function (ProductSaleElementsProductImage $pseProductImage) {
return $this->modelFactory->buildModel('Image', $pseProductImage->getProductImage());
},
iterator_to_array($images)
);
$this->setImages($images);
}
}
}

0 comments on commit ac682c5

Please sign in to comment.