* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Customer\CommandHandler; use Customer; use PrestaShop\PrestaShop\Core\Domain\Customer\Command\BulkDisableCustomerCommand; use PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\BulkDisableCustomerHandlerInterface; /** * Handles command that disables customers in bulk action. * * @internal */ final class BulkDisableCustomerHandler extends AbstractCustomerHandler implements BulkDisableCustomerHandlerInterface { /** * {@inheritdoc} */ public function handle(BulkDisableCustomerCommand $command) { foreach ($command->getCustomerIds() as $customerId) { $customer = new Customer($customerId->getValue()); $this->assertCustomerWasFound($customerId, $customer); $customer->active = false; $customer->update(); } } }