/** * @param RegistrationFlow $value The value that should be validated * @return void * @throws InvalidValidationOptionsException */ protected function isValid($value) { /** @noinspection PhpUndefinedMethodInspection */ $existingAccount = $this->accountRepository->findOneByAccountIdentifier($value->getEmail()); if ($existingAccount) { // todo: error message translatable $this->result->forProperty('email')->addError(new Error('Die Email-Adresse %s wird bereits verwendet!', 1336499566, [$value->getEmail()])); } // If a custom validation service is registered, call its validate method to allow custom validations during registration if ($this->objectManager->isRegistered(RegistrationFlowValidationServiceInterface::class)) { $instance = $this->objectManager->get(RegistrationFlowValidationServiceInterface::class); $instance->validateRegistrationFlow($value, $this); } }