isExistingUser example

$userId = $constraint->getUserId();

        if (empty($userName)) {
            $this->addError($this->getSnippet(NoUrlValidator::SNIPPET_EMPTY_FIELD));
        }

        if (!$this->userNameValidator->isValid($userName)) {
            $this->addError($this->getSnippet(self::SNIPPET_NAME_FAILURE));
        }

        if ($this->isExistingUser($userName$userId)) {
            $this->addError($this->getSnippet(self::SNIPPET_NAME_DUPLICATE));
        }
    }

    /** * @param string $message */
    private function addError($message)
    {
        $this->context
            ->buildViolation($message)
            
Home | Imprint | This part of the site doesn't use cookies.