* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\PrestaShop\Adapter\Product\CommandHandler; use PrestaShop\PrestaShop\Adapter\Product\Repository\ProductRepository; use PrestaShop\PrestaShop\Core\Domain\Product\Command\SetCarriersCommand; use PrestaShop\PrestaShop\Core\Domain\Product\CommandHandler\SetCarriersHandlerInterface; /** * Handles @var SetCarriersCommand using repository */ class SetCarriersHandler implements SetCarriersHandlerInterface { /** * @var ProductRepository */ private $productRepository; /** * @param ProductRepository $productRepository */ public function __construct( ProductRepository $productRepository ) { $this->productRepository = $productRepository; } /** * {@inheritDoc} */ public function handle(SetCarriersCommand $command): void { $this->productRepository->setCarrierReferences( $command->getProductId(), $command->getCarrierReferenceIds(), $command->getShopConstraint() ); } }