Skip to content

Commit

Permalink
Merge pull request #621 from extcode/add_bevariant_interface
Browse files Browse the repository at this point in the history
[BUGFIX] Use interfaces is event listener
  • Loading branch information
extcode authored Jan 9, 2025
2 parents 8b404b6 + 135f2d3 commit ffc98bf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Classes/EventListener/Order/Create/PersistOrder/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/

use Extcode\Cart\Domain\Model\Cart\AdditionalDataInterface;
use Extcode\Cart\Domain\Model\Cart\BeVariant;
use Extcode\Cart\Domain\Model\Cart\FeVariant;
use Extcode\Cart\Domain\Model\Cart\Product;
use Extcode\Cart\Domain\Model\Cart\BeVariantInterface;
use Extcode\Cart\Domain\Model\Cart\FeVariantInterface;
use Extcode\Cart\Domain\Model\Cart\ProductInterface;
use Extcode\Cart\Domain\Model\Order\Item;
use Extcode\Cart\Domain\Model\Order\Product;
use Extcode\Cart\Domain\Model\Order\ProductAdditional;
use Extcode\Cart\Domain\Repository\Order\ProductAdditionalRepository;
use Extcode\Cart\Domain\Repository\Order\ProductRepository;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function __invoke(PersistOrderEvent $event): void
protected function addProduct(ProductInterface $cartProduct): void
{
$orderProduct = GeneralUtility::makeInstance(
\Extcode\Cart\Domain\Model\Order\Product::class
Product::class
);
$orderProduct->setSku($cartProduct->getSku());
$orderProduct->setTitle($cartProduct->getTitle());
Expand All @@ -86,7 +86,7 @@ protected function addProduct(ProductInterface $cartProduct): void
$this->addFeVariants($orderProduct, $cartProduct->getFeVariant());
}

protected function addProductVariants(Product $product): void
protected function addProductVariants(ProductInterface $product): void
{
foreach ($product->getBeVariants() as $variant) {
if ($variant->getBeVariants()) {
Expand All @@ -98,8 +98,8 @@ protected function addProductVariants(Product $product): void
}

protected function addFeVariants(
\Extcode\Cart\Domain\Model\Order\Product $product,
?FeVariant $feVariant = null
Product $product,
?FeVariantInterface $feVariant = null
): void {
if ($feVariant) {
$feVariantsData = $feVariant->getVariantData();
Expand All @@ -113,7 +113,7 @@ protected function addFeVariants(

protected function addProductAdditional(
string $productAdditionalType,
\Extcode\Cart\Domain\Model\Order\Product $product,
Product $product,
array $feVariant
): void {
$productAdditional = GeneralUtility::makeInstance(
Expand All @@ -130,7 +130,7 @@ protected function addProductAdditional(
$product->addProductAdditional($productAdditional);
}

protected function addVariantsOfVariant(BeVariant $variant, int $level): void
protected function addVariantsOfVariant(BeVariantInterface $variant, int $level): void
{
$level += 1;

Expand All @@ -143,12 +143,12 @@ protected function addVariantsOfVariant(BeVariant $variant, int $level): void
}
}

protected function addBeVariant(BeVariant $variant, int $level): void
protected function addBeVariant(BeVariantInterface $variant, int $level): void
{
$cartProduct = $variant->getProduct();

$orderProduct = GeneralUtility::makeInstance(
\Extcode\Cart\Domain\Model\Order\Product::class
Product::class
);
$orderProduct->setSku($variant->getCompleteSku());
$orderProduct->setTitle($variant->getCompleteTitle());
Expand Down

0 comments on commit ffc98bf

Please sign in to comment.