Skip to content

Commit

Permalink
OP-289: Fix handling unpacked bundles in shop
Browse files Browse the repository at this point in the history
  • Loading branch information
hmfilar committed Sep 9, 2024
1 parent 65e9982 commit 3dff2a8
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 9 deletions.
17 changes: 17 additions & 0 deletions src/Command/AddProductBundleToCartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@

namespace BitBag\SyliusProductBundlePlugin\Command;

use Doctrine\Common\Collections\Collection;

final class AddProductBundleToCartCommand implements OrderIdentityAwareInterface, ProductCodeAwareInterface
{
/** @var Collection<int, AddProductBundleItemToCartCommand> */
private Collection $productBundleItems;

public function __construct(
private int $orderId,
private string $productCode,
Expand All @@ -34,4 +39,16 @@ public function getQuantity(): int
{
return $this->quantity;
}

/** @return Collection<int, AddProductBundleItemToCartCommand> */
public function getProductBundleItems(): Collection
{
return $this->productBundleItems;
}

/** @param Collection<int, AddProductBundleItemToCartCommand> $productBundleItems */
public function setProductBundleItems(Collection $productBundleItems): void
{
$this->productBundleItems = $productBundleItems;
}
}
12 changes: 10 additions & 2 deletions src/Factory/AddProductBundleToCartCommandFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,33 @@

namespace BitBag\SyliusProductBundlePlugin\Factory;

use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand;
use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand;
use BitBag\SyliusProductBundlePlugin\Dto\AddProductBundleToCartDtoInterface;
use Doctrine\Common\Collections\Collection;

final class AddProductBundleToCartCommandFactory implements AddProductBundleToCartCommandFactoryInterface
{
/** @param Collection<int, AddProductBundleItemToCartCommand> */
public function createNew(

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63

Check failure on line 22 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

PHPDoc tag @param has invalid value (Collection<int, AddProductBundleItemToCartCommand>): Unexpected token "*/", expected variable at offset 63
int $orderId,
string $productCode,
int $quantity,
Collection $productBundleItems,
): AddProductBundleToCartCommand {
return new AddProductBundleToCartCommand($orderId, $productCode, $quantity);
$command = new AddProductBundleToCartCommand($orderId, $productCode, $quantity);
$command->setProductBundleItems($productBundleItems);

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.3, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.12, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.1, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^6.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

Check failure on line 29 in src/Factory/AddProductBundleToCartCommandFactory.php

View workflow job for this annotation

GitHub Actions / Sylius ^1.13, PHP 8.2, Symfony ^5.4

Parameter #1 $productBundleItems of method BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand::setProductBundleItems() expects Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand>, Doctrine\Common\Collections\Collection<int, BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface> given.

return $command;
}

public function createFromDto(AddProductBundleToCartDtoInterface $dto): AddProductBundleToCartCommand
{
$cartId = $dto->getCart()->getId();
$productCode = $dto->getProduct()->getCode() ?? '';
$quantity = $dto->getCartItem()->getQuantity();
$productBundleItems = $dto->getProductBundleItems();

return $this->createNew($cartId, $productCode, $quantity);
return $this->createNew($cartId, $productCode, $quantity, $productBundleItems);
}
}
4 changes: 4 additions & 0 deletions src/Factory/AddProductBundleToCartCommandFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@

use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand;
use BitBag\SyliusProductBundlePlugin\Dto\AddProductBundleToCartDtoInterface;
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface;
use Doctrine\Common\Collections\Collection;

interface AddProductBundleToCartCommandFactoryInterface
{
/** @param Collection<int, ProductBundleOrderItemInterface> $productBundleItems */
public function createNew(
int $orderId,
string $productCode,
int $quantity,
Collection $productBundleItems,
): AddProductBundleToCartCommand;

public function createFromDto(AddProductBundleToCartDtoInterface $dto): AddProductBundleToCartCommand;
Expand Down
13 changes: 13 additions & 0 deletions src/Factory/ProductBundleOrderItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace BitBag\SyliusProductBundlePlugin\Factory;

use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand;
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface;
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
Expand Down Expand Up @@ -41,4 +42,16 @@ public function createFromProductBundleItem(ProductBundleItemInterface $bundleIt

return $productBundleOrderItem;
}

public function createFromAddProductBundleItemToCartCommand(AddProductBundleItemToCartCommand $addItemToCartCommand): ProductBundleOrderItemInterface
{
/** @var ProductBundleOrderItemInterface $productBundleOrderItem */
$productBundleOrderItem = $this->decoratedFactory->createNew();

$productBundleOrderItem->setProductBundleItem($addItemToCartCommand->getProductBundleItem());
$productBundleOrderItem->setProductVariant($addItemToCartCommand->getProductVariant());
$productBundleOrderItem->setQuantity($addItemToCartCommand->getQuantity());

return $productBundleOrderItem;
}
}
3 changes: 3 additions & 0 deletions src/Factory/ProductBundleOrderItemFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@

namespace BitBag\SyliusProductBundlePlugin\Factory;

use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand;
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface;
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;

interface ProductBundleOrderItemFactoryInterface extends FactoryInterface
{
public function createFromProductBundleItem(ProductBundleItemInterface $bundleItem): ProductBundleOrderItemInterface;

public function createFromAddProductBundleItemToCartCommand(AddProductBundleItemToCartCommand $addItemToCartCommand): ProductBundleOrderItemInterface;
}
5 changes: 4 additions & 1 deletion src/Handler/AddProductBundleToCartHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public function __invoke(AddProductBundleToCartCommand $addProductBundleToCartCo
$quantity = $addProductBundleToCartCommand->getQuantity();
Assert::greaterThan($quantity, 0);

$this->cartProcessor->process($cart, $productBundle, $quantity);
$items = $addProductBundleToCartCommand->getProductBundleItems();
Assert::false($items->isEmpty());

$this->cartProcessor->process($cart, $productBundle, $quantity, $items);
$this->orderRepository->add($cart);
}
}
14 changes: 8 additions & 6 deletions src/Handler/AddProductBundleToCartHandler/CartProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleInterface;
use BitBag\SyliusProductBundlePlugin\Factory\OrderItemFactoryInterface;
use BitBag\SyliusProductBundlePlugin\Factory\ProductBundleOrderItemFactoryInterface;
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Order\Model\OrderInterface;
use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface;
Expand All @@ -23,17 +24,18 @@
final class CartProcessor implements CartProcessorInterface
{
public function __construct(
private OrderItemQuantityModifierInterface $orderItemQuantityModifier,
private ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory,
private OrderModifierInterface $orderModifier,
private OrderItemFactoryInterface $cartItemFactory,
private readonly OrderItemQuantityModifierInterface $orderItemQuantityModifier,
private readonly ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory,
private readonly OrderModifierInterface $orderModifier,
private readonly OrderItemFactoryInterface $cartItemFactory,
) {
}

public function process(
OrderInterface $cart,
ProductBundleInterface $productBundle,
int $quantity,
Collection $productBundleOrderItems,
): void {
Assert::greaterThan($quantity, 0);

Expand All @@ -47,8 +49,8 @@ public function process(
$cartItem = $this->cartItemFactory->createWithVariant($productVariant);
$this->orderItemQuantityModifier->modify($cartItem, $quantity);

foreach ($productBundle->getProductBundleItems() as $bundleItem) {
$productBundleOrderItem = $this->productBundleOrderItemFactory->createFromProductBundleItem($bundleItem);
foreach ($productBundleOrderItems as $addBundleItemToCartCommand) {
$productBundleOrderItem = $this->productBundleOrderItemFactory->createFromAddProductBundleItemToCartCommand($addBundleItemToCartCommand);
$cartItem->addProductBundleOrderItem($productBundleOrderItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace BitBag\SyliusProductBundlePlugin\Handler\AddProductBundleToCartHandler;

use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleInterface;
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Order\Model\OrderInterface;

interface CartProcessorInterface
Expand All @@ -20,5 +21,6 @@ public function process(
OrderInterface $cart,
ProductBundleInterface $productBundle,
int $quantity,
Collection $productBundleOrderItems,
): void;
}

0 comments on commit 3dff2a8

Please sign in to comment.