Validates the supplied fields match.

@param string $fieldName
@param string $otherFieldName

@return static
@throws InvalidArgumentException If the fields dont exist
326786
public function fieldsMatch(string $fieldName, string $otherFieldName)
    {
        $this->validateFieldsExist(__METHOD__, $fieldName, $otherFieldName);

        return $this->validate(new MatchingFieldsValidator($this->fields[$fieldName], $this->fields[$otherFieldName]));
    }
196908
public function findFieldInArray($fieldname) {
        foreach ($this->fields as $i => $field) {
            if ($fieldname == $field->getName()) {
                return $i;
            }
        }
        return null;
    }
653637
public function hasField($tableName, $fieldName)
    {
        if (!$this->hasTable($tableName)) {
            return false;
        }
        $fields = $this->fieldList($tableName);
        return array_key_exists($fieldName, $fields);
    }
475226
def validateField(cls, fieldName, value) :
        
        try :
            valValue = Collection.validateField(fieldName, value)
        except SchemaViolation as e:
            if fieldName == "_from" or fieldName == "_to" :
                return True
            else :
                raise e
        return valValue
1293218
public function addRequiredFields($fields, ...$otherFields)
    {
        if(!is_array($fields)) {
            $fields = [$fields];
        }
        if(!empty($otherFields)) {
            $fields = array_merge($fields, $otherFields);
        }
        if (ArrayLib::is_associative($fields)) {
            foreach ($fields as $k => $v) {
                $constraint = Constraint_required::create();
                if ($v) {
                    $constraint->setMessage($v);
                }
                $this->setConstraint($k, $constraint);
            }
        } else {
            foreach ($fields as $field) {
                $this->setConstraint($field, Constraint_required::create());
            }
        }

        return $this;
    }
1284278
public function setFieldValue($fieldName, $value)
    {
        if (isset($this->originalValues[$fieldName])
            && $this->originalValues[$fieldName] === $value
        ) {
            # the given value is the same as the original value;
            # ignore any given value
            unset($this->givenValues[$fieldName]);
        } elseif (isset($this->originalValues[$fieldName])
            && $this->originalValues[$fieldName] !== $value
            && isset($this->defaults[$fieldName])
            && $this->defaults[$fieldName] === $value
        ) {
            # the given value is the same as a default value, but different from
            # the original value; change it
            $this->givenValues[$fieldName] = $value;
        } elseif (isset($this->defaults[$fieldName])
            && $this->defaults[$fieldName] === $value
        ) {
            # the given value is the same as the default value;
            # ignore any given value
            unset($this->givenValues[$fieldName]);
        } else {
            $this->givenValues[$fieldName] = $value;
        }
        return $this;
    }
537722
public function generateSlugsFrom($fieldName): self
    {
        if (is_string($fieldName)) {
            $fieldName = [$fieldName];
        }

        $this->generateSlugFrom = $fieldName;

        return $this;
    }
700906
public static function isFieldEditable($fieldName) {
		if( $fieldName == static::$IDFIELD ) {
			return false;
		}
		if( !is_null(static::$editableFields) ) {
			return in_array($fieldName, static::$editableFields);
		}
		if( method_exists(static::$validator, 'isFieldEditable') ) {
			return in_array($fieldName, static::$editableFields);
		}
		return in_array($fieldName, static::$fields);
	}
712731
public function setDateOther($other, $field = null)
    {
        $param = $this->buildParam('facet.date.other', $field);
        return $this->set($param, $other);
    }
17151
protected function validateField($fieldName, $value)
    {
        if (!$this->validateValue($value)) {
            $this->validationError(
                $fieldName,
                _t(
                    __CLASS__ . '.InvalidValue',
                    'Synonyms cannot contain words separated by spaces'
                )
            );
        }
    }
1029953
public function verifyNewFieldDefinitionFormExists(string $fieldName): void
    {
        $form = $this->context->getElementByText(sprintf($this::NEW_FIELD_TITLE_PATTERN, EzFieldElement::getFieldInternalNameByName($fieldName)), $this->fields['fieldDefinitionName']);
        if ($form === null) {
            throw new \Exception('Field definition not added to the form.');
        }
    }
571200
public function getLocalizedFieldName($fieldName)
    {
        if ($this->isLocalizedField($fieldName) || $this->isLocalizedRelation($fieldName)) {
            return self::localized_field($fieldName);
        }
        trigger_error("Field '$fieldName' is not a localized field", E_USER_ERROR);
    }
1063973
protected function _convertValidatorToArray($fieldName, $defaults = [], $settings = [])
    {
        if (is_string($settings)) {
            $fieldName = $settings;
            $settings = [];
        }
        if (!is_array($settings)) {
            throw new InvalidArgumentException(
                sprintf('Invalid settings for "%s". Settings must be an array.', $fieldName)
            );
        }
        $settings += $defaults;

        return [$fieldName => $settings];
    }
505757
protected function getArrayAndKeyName(string $fieldName, string $key): array
    {
        if (!in_array($key, ['filters', 'sorts'], true)) {
            throw new InvalidArgumentException('Key must be one of [filters, sorts]');
        }
        if (str_contains($fieldName, '.')) {
            $path         = explode('.', $fieldName);
            $name         = array_pop($path);
            $relationPath = implode('.', $path);
            $array        = array_get($this->relations, "$relationPath.$key", []);
        } else {
            $name  = $fieldName;
            $array = ($key === 'filters') ? $this->filters : $this->sorts;
        }
        return [$name, $array];
    }
26630
protected function fails($fieldname = null) {
		
		$helper = new StringToArray();
		return $helper -> execute($fieldname, null, Message :: getErrors(true));
	}
144819
protected static function fieldExists($sFieldName, $sTableName)
    {
        $oDbMetaDataHandler = oxNew(DbMetaDataHandler::class );

        return $oDbMetaDataHandler->fieldExists($sFieldName, $sTableName);
    }
177685
public function verifyFieldHasValue(string $fieldName, $value, ?string $containerName = null): void
    {
        $fieldElement = $this->getField($fieldName, $containerName);
        Assert::assertEquals(
            $value,
            $fieldElement->getValue(),
            'Field has wrong value'
        );
    }