* @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\Update\RelatedProductsUpdater; use PrestaShop\PrestaShop\Core\Domain\Product\Command\SetRelatedProductsCommand; use PrestaShop\PrestaShop\Core\Domain\Product\CommandHandler\SetRelatedProductsHandlerInterface; /** * handles @see SetRelatedProductsCommand using legacy object models */ final class SetRelatedProductsHandler implements SetRelatedProductsHandlerInterface { /** * @var RelatedProductsUpdater */ private $relatedProductsUpdater; /** * @param RelatedProductsUpdater $relatedProductsUpdater */ public function __construct( RelatedProductsUpdater $relatedProductsUpdater ) { $this->relatedProductsUpdater = $relatedProductsUpdater; } /** * {@inheritdoc} */ public function handle(SetRelatedProductsCommand $command): void { $this->relatedProductsUpdater->setRelatedProducts($command->getProductId(), $command->getRelatedProductIds()); } }