moduleManager = $moduleManager; } public function validate($account, Constraint $constraint) { if (!($constraint instanceof IntegrationModuleAccess)) { throw new UnexpectedTypeException($constraint, IntegrationModuleAccess::class); } try { $this->moduleManager->checkAccess(); } catch (ServerUnreachableException $e) { $this->context ->buildViolation('integration_module_access.server_unreachable_exception') ->atPath($constraint->path) ->addViolation() ; } catch (AbstractModuleException $e) { $this->context ->buildViolation('integration_module_access.module_access_exception') ->atPath($constraint->path) ->addViolation() ; } } }