{@inheritdoc}

@param string $fieldName
@param Model  $modelObject

@throws FieldError

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
489071
public function contributeToClass($fieldName, $modelObject)
    {
        if (!StringHelper::isValidVariableName($fieldName)) {
            throw new FieldError(
                sprintf(
                    ' "%s" is not a valid field name on the model "%s" .',
                    $fieldName,
                    $modelObject->getFullClassName()
                )
            );
        }

        $this->scopeModel = $modelObject;
        $this->setFromName($fieldName);
        $this->scopeModel->getMeta()->addField($this);
        $this->scopeModel->_valueCache[$this->getAttrName()] = $this->getDefault();
    }
183801
public function display(string $fieldname, $value, string $model = null)
    {
        $value = $value === true ? 'true' : 'false';

        return $value;
    }
1209084
public function setFieldValue($object, $field, $value)
    {
        $this->assertObjectInstance($object);

        return $this->getField($field)->set($object, $value);
    }
559703
protected function getHeaderFieldAccessor(array $fields, $modelName)
    {
        $field = $this->getHeaderField($fields);

        return !is_null($field) ? sprintf('$%s->%s', $this->getSingularVariable($modelName), $field->name) : '$title';
    }
480980
public function addField($fieldName, Field $field)
    {
        $this->fieldNames[ $fieldName ] = $fieldName;
        $this->fields[ $fieldName ]     = $field;

        return $fieldName;
    }
139488
public function update($object)
    {
        try {
            $this->dm->persist($object);
            $this->dm->flush();
        } catch (\Exception $e) {
            throw new ModelManagerException('', 0, $e);
        }
    }
894486
public function getFieldMapping($fieldName)
    {
        if (!$this->hasField($fieldName)) {
            throw MappingException::fieldNotFound($this->name, $fieldName);
        }

        return $this->mappings[$fieldName];
    }
1224592
public static function getFieldKey($fieldName, $fieldId)
    {
        if (isset(get_field_objects($fieldId)[$fieldName]['key'])) {
            return get_field_objects($fieldId)[$fieldName]['key'];
        }

        return false;
    }
259709
public function findByObject($object, $fieldId = null)
    {
        $qb = $this->createQueryBuilder('cf');
        $this->addFindByObject($qb, 'cf', $object, $fieldId);

        return $qb->getQuery()->getResult();
    }
1137581
public function getField($objectName, $fieldName, $excludeFormDefaults = true)
    {
        $modelConfiguration = $this->getModelConfiguration($objectName);
        if (isset($modelConfiguration['__field_index'][$fieldName])) {
            $fieldConfiguration = array_replace_recursive($this->defaultFieldConfiguration, $modelConfiguration['fields'][$modelConfiguration['__field_index'][$fieldName]]);
            if ($excludeFormDefaults && isset($fieldConfiguration['form_defaults'])) {
                unset($fieldConfiguration["form_defaults"]);
            }

            return $fieldConfiguration;
        }
    }
1159365
function &fieldNamed($fieldName)
    {
        $return = NULL;
        if (isset($this->_fields[$fieldName])) {
            $return =& $this->_fields[$fieldName];
        }

        return $return;
    }
1104287
public function display(string $fieldname, $value, string $model = null)
    {
        if (is_array($value)) {
            $return = '';
            foreach ($value as $v) {
                if ($return == '') {
                    $return .= $v;
                } else {
                    $return .= ', ' . $v;
                }
            }
            $value = $return;
        }

        return $value;
    }
12195
public function getFieldNames($objectName)
    {
        $fieldNames = array();
        $modelConfiguration = $this->getModelConfiguration($objectName);
        if (isset($modelConfiguration['__field_index'])) {
            $fieldNames = array_keys($modelConfiguration['__field_index']);
        }

        return $fieldNames;
    }
850783
private function getOldFieldName($modelName, $fieldName)
    {
        $modelRenamedFields = ArrayHelper::getValue(
            $this->renamedFields,
            $modelName,
            []
        );
        if ($modelRenamedFields) {
            $fieldName = ArrayHelper::getValue(
                $modelRenamedFields,
                $fieldName,
                $fieldName
            );
        }

        return $fieldName;
    }
190234
public function fillModel(&$model, $input)
    {
        $model->{$this->getOption('field_name')} = $input === 'true' || $input === '1' || $input === true ? 1 : 0;
    }
1074061
private static function _isRequired($object, $fieldName)
    {
        $reflectionClass = new \ReflectionClass($object);
        if ($reflectionClass->hasMethod('requiredFields')) {
            return in_array($fieldName, $object->requiredFields());
        }

        return false;
    }
853011
public function field($fieldName, $fieldValue = '', $fieldBoost = null) {
        if(empty($fieldName)) {
            throw new \InvalidArgumentException('Please provide a fieldname');
        }
        $field = array(
			'name'=> $fieldName,
			'value' => $fieldValue
        );
        if(!empty($fieldBoost)) {
            $field['boost'] = $fieldBoost;
        }
        $this->fields[] = $field;
        return $this;
    }