Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Use interfaces is event listener #621

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading