framework/validators/ExistValidator.php
protected function validateValue($value)
    {
        if ($this->targetClass === null) {
            throw new InvalidConfigException('The "targetClass" property must be set.');
        }
        if (!is_string($this->targetAttribute)) {
            throw new InvalidConfigException('The "targetAttribute" property must be configured as a string.');
        }

        if (is_array($value) && !$this->allowArray) {
            return [$this->message, []];
        }

        $query = $this->createQuery($this->targetClass, [$this->targetAttribute => $value]);

        return $this->valueExists($this->targetClass, $query, $value) ? null : [$this->message, []];
    }
protected function validateValue($value)
    {
        if ($this->targetClass === null) {
            throw new InvalidConfigException('The "targetClass" property must be set.');
        }
        if (!is_string($this->targetAttribute)) {
            throw new InvalidConfigException('The "targetAttribute" property must be configured as a string.');
        }

        if (is_array($value) && !$this->allowArray) {
            return [$this->message, []];
        }

        $query = $this->createQuery($this->targetClass, [$this->targetAttribute => $value]);

        return $this->valueExists($this->targetClass, $query, $value) ? null : [$this->message, []];
    }
protected function validateValue ( $ value ) { if ( $ this -> targetClass === null ) { throw new InvalidConfigException ( 'The "targetClass" property must be set.' ) ; } if ( ! is_string ( $ this -> targetAttribute ) ) { throw new InvalidConfigException ( 'The "targetAttribute" property must be configured as a string.' ) ; } if ( is_array ( $ value ) && ! $ this -> allowArray ) { return [ $ this -> message , [ ] ] ; } $ query = $ this -> createQuery ( $ this -> targetClass , [ $ this -> targetAttribute => $ value ] ) ; return $ this -> valueExists ( $ this -> targetClass , $ query , $ value ) ? null : [ $ this -> message , [ ] ] ; }
{@inheritdoc}
{