* @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\ProductCategoryUpdater; use PrestaShop\PrestaShop\Core\Domain\Product\Command\RemoveAllAssociatedProductCategoriesCommand; use PrestaShop\PrestaShop\Core\Domain\Product\CommandHandler\RemoveAllAssociatedProductCategoriesHandlerInterface; /** * Handles @see RemoveAllAssociatedProductCategoriesCommand using legacy object model */ final class RemoveAllAssociatedProductCategoriesHandler implements RemoveAllAssociatedProductCategoriesHandlerInterface { /** * @var ProductCategoryUpdater */ private $productCategoryUpdater; /** * @param ProductCategoryUpdater $productCategoryUpdater */ public function __construct( ProductCategoryUpdater $productCategoryUpdater ) { $this->productCategoryUpdater = $productCategoryUpdater; } /** * {@inheritdoc} */ public function handle(RemoveAllAssociatedProductCategoriesCommand $command): void { $this->productCategoryUpdater->removeAllCategories($command->getProductId(), $command->getShopConstraint()); } }