Validate field values, raising errors if the values are invalid.

@param string $fieldName
@param mixed $value
17151
protected function validateField($fieldName, $value)
    {
        if (!$this->validateValue($value)) {
            $this->validationError(
                $fieldName,
                _t(
                    __CLASS__ . '.InvalidValue',
                    'Synonyms cannot contain words separated by spaces'
                )
            );
        }
    }
243096
public function setNewValue($field, $value)
    {
        $this->assertValidField($field);

        $this->entityChangeSet[$field][1] = $value;
    }
1279728
public function set($fieldName, $value)
    {
        parent::set($fieldName, $value);

        // if document saved - save through update
        if ($this->getId()) {
            $this->operator->set($fieldName, $value);
        }

        return $this;
    }
1051148
protected function validateRequired($field, $value)
    {
        if (is_null($value)) {
            return false;
        } elseif (is_string($value) && '' === trim($value)) {
            return false;
        }

        return true;
    }
714809
public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (sizeof($validatorParams) < ($this->mode == self::MODE_RANGE ? 2 : 1)) {
            throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
        }

        if (!$value) return true;

        switch ($this->mode) {
            case self::MODE_MIN:
                return strlen($value) >= $validatorParams[0];
            case self::MODE_MAX:
                return strlen($value) <= $validatorParams[0];
            case self::MODE_RANGE:
                return strlen($value) <= $validatorParams[1] && strlen($value) >= $validatorParams[0];
        }

    }
1322676
private function callValidators($value, ValidationField $field) {
        $valid = true;

        // Strip array references in the name except for the last one.
        $key = $field->getSchemaPath();
        if (!empty($this->validators[$key])) {
            foreach ($this->validators[$key] as $validator) {
                $r = call_user_func($validator, $value, $field);

                if ($r === false || Invalid::isInvalid($r)) {
                    $valid = false;
                }
            }
        }

        // Add an error on the field if the validator hasn't done so.
        if (!$valid && $field->isValid()) {
            $field->addError('invalid', ['messageCode' => 'The value is invalid.']);
        }
    }
486873
public function setValue($value)
    {
        if (is_scalar($value) or is_null($value)) {
            return;
        }
        foreach ($value as $name => $val) {
            if ($field = $this[$name]) {
                $field->getElement()->setValue($val);
            }
        }
    }
142553
protected function validate($value){
        if( parent::validate($value) ){
            if( $this->required && empty($value) ){
                throw new ValidateException(sprintf($this->__('Field %s is required.'), $this->label));
            }
            return true;
        }else{
            return false;
        }
    }
820613
protected static function parseFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->parseValue($field, $value);
		}
		return parent::parseFieldValue($name, $value);
	}
31001
public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (!$value) return true;

        if ($this->regexp) {
            $regexp = $this->regexp;
        } else {
            if (sizeof($validatorParams) < 1) {
                throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
            }

            $regexp = $validatorParams[0];

        }

        return preg_match("/^" . $regexp . "$/", $value) == 1;

    }
270465
public function fillFieldWithValue(string $fieldName, $value, ?string $containerName = null): void
    {
        $newContainerName = (!$containerName) ? $containerName : sprintf($this::NEW_FIELD_TITLE_PATTERN, EzFieldElement::getFieldInternalNameByName($containerName));
        $fieldElement = $this->getField($fieldName, $newContainerName);
        $fieldElement->setValue($value);
    }
617702
public static function validate($class, $field, $value)
    {
        $abstractEnum = 'Eway\Rapid\Enum\AbstractEnum';
        if (!is_subclass_of($class, $abstractEnum)) {
            throw new InvalidArgumentException(sprintf('%s must extends %s', $class, $abstractEnum));
        }

        if (!call_user_func($class.'::isValidValue', $value, true)) {
            throw new InvalidArgumentException(call_user_func($class.'::getValidationMessage', $field));
        }

        return $value;
    }
272656
public function putValue($field, $value) {
		$this->validateValue($field, $value);
		$this->setValue($field, $value);
	}
240780
public function increment($fieldName, $value = 1)
    {
        parent::set($fieldName, (int) $this->get($fieldName) + $value);

        if ($this->getId()) {
            $this->operator->increment($fieldName, $value);
        }


        return $this;
    }
38904
protected function confirmValidate($value, $field)
    {
        return isset($this->data[$field]) && $this->data[$field] === $value;
    }
1319492
protected function isValueValid($value) {
		$this->checkValue($value);
		
		if ($this->validatable === null) {
			return true;
		}
		
		return $this->validatable->testEiFieldValue($this->eiu, $value);
	}
875225
protected function validateEditFieldValue()
    {
        $this->setSubmitted('field_value');
        $this->setSubmitted('update', $this->data_field_value);
        $this->setSubmitted('field_id', $this->data_field['field_id']);

        $this->validateComponent('field_value');

        return !$this->hasErrors();
    }