* @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\BulkEnableCustomerCommand; use PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\BulkEnableCustomerHandlerInterface; /** * Handles command which enables given customers. * * @internal */ final class BulkEnableCustomerHandler extends AbstractCustomerHandler implements BulkEnableCustomerHandlerInterface { /** * {@inheritdoc} */ public function handle(BulkEnableCustomerCommand $command) { foreach ($command->getCustomerIds() as $customerId) { $customer = new Customer($customerId->getValue()); $this->assertCustomerWasFound($customerId, $customer); $customer->active = true; $customer->update(); } } }