Verify that field values are set.

@param string $fieldName
@param string $value
@param null|string $containerName for fields that defines new field type in content type

@throws \Exception
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'
        );
    }
620046
public function assign($fieldname, $value = null)
    {
        if ($fieldname instanceOf Block) {
            $this->blocks[] = $fieldname;
            return $this;
        }

        if (is_array($fieldname) && !empty($fieldname)) { // bulk fields assignment
            foreach ($fieldname as $field => $val) {
                $this->fields[$field] = $val;
            }
            return $this;
        }

        if (is_string($fieldname) && $value instanceOf Image) {
            $this->images['image:' . $fieldname] = $value->getName();
            return $this;
        }

        if (is_string($fieldname) && !is_null($value)) {
            $this->fields[$fieldname] = $value;
            return $this;
        }

        throw new ContainerException('Incorrect parameters for assignment');
    }
17151
protected function validateField($fieldName, $value)
    {
        if (!$this->validateValue($value)) {
            $this->validationError(
                $fieldName,
                _t(
                    __CLASS__ . '.InvalidValue',
                    'Synonyms cannot contain words separated by spaces'
                )
            );
        }
    }
981668
public function SetValue($FieldName, $Value) {
      if (!is_array($this->_DataArray))
         $this->_DataArray = array();
      
      $this->_DataArray[$FieldName] = $Value;
   }
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);
            }
        }
    }
490742
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
   {
      m_writer.writeStartObject(objectName);
      for (FieldType field : fields)
      {
         Object value = container.getCurrentValue(field);
         if (value != null)
         {
            writeField(field, value);
         }
      }
      m_writer.writeEndObject();
   }
475396
public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
    {
        $fieldValue->data = $value->dataText === null
            ? null
            : $this->restoreValueFromXmlString($value->dataText);
    }
346017
public function fieldValue($field, $value)
    {
        if (!in_array($field, $this->supports)) {
            $this->supports[ ] = $field;
        }
        $this->values[ $field ] = $value;

        return $this;
    }
834300
public function SetFormValue($FieldName, $Value = NULL) {
      $this->FormValues();
      if (is_array($FieldName))
         $this->_FormValues = array_merge($this->_FormValues, $FieldName);
      else
         $this->_FormValues[$FieldName] = $Value;
   }
395418
protected function getRealValue(ContainerBuilder $container, $value)
    {
        return 0 === strpos($value, '%') ? $container->getParameter(trim($value, '%')) : $value;
    }
1342144
public void addListFieldValue(String fieldName, Object value) {
		Object val = value;
		if (value instanceof DomainObject)
			val = ((DomainObject)value).getRawObject();
		Object lst = getFieldValue(fieldName, true); // internal
		
		DOField fld = getDomainObjectType().getFieldByName(fieldName);
		String ctn = fld.getComponentTypeName();
		Class<?> clazz;
		try {
			clazz = getDomainObjectType().getDomainModel().getClassForName(ctn);
			if (!clazz.isAssignableFrom(val.getClass()))
				throw new RuntimeException("value must be of type or subtype of: [" + clazz.getName() + "]");
			lst = tryInitListOrArray(lst, fld, clazz);
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
		
		if (lst instanceof List<?>) {
			@SuppressWarnings("unchecked")
			List<Object> list = (List<Object>)lst;
			list.add(val);
		} else if (lst != null && lst.getClass().isArray()) {
			int len = Array.getLength(lst);
			Object array = Array.newInstance(clazz, len + 1);
			for (int i = 0; i < len; i++) {
				Array.set(array, i, Array.get(lst, i));
			}
			Array.set(array, len, val);
		} else {
			if (!getDomainObjectType().getFieldByName(fieldName).isListOrArray())
				throw new RuntimeException("field: [" + fieldName + "] is neither list nor array");
			if (lst == null)
				throw new RuntimeException("field: [" + fieldName + "] has not been initialized as list or array");
		}
	}
887745
protected function castValue($gridField, $fieldName, $value)
    {
        // If a fieldCasting is specified, we assume the result is safe
        if (array_key_exists($fieldName, $this->fieldCasting)) {
            $value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]);
        } elseif (is_object($value)) {
            // If the value is an object, we do one of two things
            if (method_exists($value, 'Nice')) {
                // If it has a "Nice" method, call that & make sure the result is safe
                $value = Convert::raw2xml($value->Nice());
            } else {
                // Otherwise call forTemplate - the result of this should already be safe
                $value = $value->forTemplate();
            }
        } else {
            // Otherwise, just treat as a text string & make sure the result is safe
            $value = Convert::raw2xml($value);
        }

        return $value;
    }
299677
public function setValue($field, $value) {
        if (is_array($this->values)) {
            $this->values[$field] = $value;
        } elseif (is_object($this->values)) {
            $this->values->$field = $value;
        }
    }
243096
public function setNewValue($field, $value)
    {
        $this->assertValidField($field);

        $this->entityChangeSet[$field][1] = $value;
    }
1088695
public function handle(Container $container) {
        $fieldSet = $container->make($this->argument('field'));

        $this->heading('Field Set');

        $fields = [];
        foreach($fieldSet->getFields() as $field) {
            $fields[] = $this->getFieldInformation($field);
        }
        $this->table($this->fieldHeaders, $fields);
    }
765815
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container)
   {
      if (row != null)
      {
         for (Map.Entry<String, FieldType> entry : map.entrySet())
         {
            container.set(entry.getValue(), row.getObject(entry.getKey()));
         }
      }
   }
455275
public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (sizeof($validatorParams) < 1) {
            throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
        }

        $otherField = $validatorParams[0];
        if (trim($otherField, "'\"") == $otherField) {
            $otherFieldValue = $targetObject->__getSerialisablePropertyValue($otherField);
            return $value == $otherFieldValue;
        } else {
            return $value == $validatorParams[0];
        }

    }