* @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\Profile\Employee\CommandHandler; use Employee; use PrestaShop\PrestaShop\Core\Domain\Employee\Command\BulkUpdateEmployeeStatusCommand; use PrestaShop\PrestaShop\Core\Domain\Employee\CommandHandler\BulkUpdateEmployeeStatusHandlerInterface; /** * Class BulkUpdateEmployeeStatusHandler. */ final class BulkUpdateEmployeeStatusHandler extends AbstractEmployeeHandler implements BulkUpdateEmployeeStatusHandlerInterface { /** * {@inheritdoc} */ public function handle(BulkUpdateEmployeeStatusCommand $command) { foreach ($command->getEmployeeIds() as $employeeId) { $employee = new Employee($employeeId->getValue()); $this->assertEmployeeWasFoundById($employeeId, $employee); $this->assertLoggedInEmployeeIsNotTheSameAsBeingUpdatedEmployee($employee); $this->assertEmployeeIsNotTheOnlyAdminInShop($employee); $employee->active = $command->getStatus(); $employee->save(); } } }