@param $object
@param $field

@return mixed
489884
public static function getObjectFieldValue($object, $field)
    {
        if (is_array($object)) {
            return $object[$field];
        }

        $accessors = array('get', 'is');

        foreach ($accessors as $accessor) {
            $accessor .= $field;

            if (!method_exists($object, $accessor)) {
                continue;
            }

            return $object->$accessor();
        }

        // __call should be triggered for get.
        $accessor = $accessors[0] . $field;

        if (method_exists($object, '__call')) {
            return $object->$accessor();
        }

        if ($object instanceof \ArrayAccess) {
            return $object[$field];
        }

        if (isset($object->$field)) {
            return $object->$field;
        }

        // camelcase field name to support different variable naming conventions
        $ccField = preg_replace_callback('/_(.?)/', function ($matches) {
            return strtoupper($matches[1]);
        }, $field);

        foreach ($accessors as $accessor) {
            $accessor .= $ccField;


            if (!method_exists($object, $accessor)) {
                continue;
            }

            return $object->$accessor();
        }

        return $object->$field;
    }
176192
private function getFieldType($field): ?string
    {
        if ($field === null) {
            return null;
        }

        $fieldType = gettype($field);
        if ($fieldType === 'object') {
            $classNameArray = explode('\\', get_class($field));
            if (count($classNameArray) === 0) {
                return null;
            }

            $fieldType = mb_strtolower($classNameArray[count($classNameArray) - 1]);
        }

        return $fieldType;
    }
713107
public function getError($field) {
        if(array_key_exists($field, $this->errors)) {
            return $this->errors[$field];
        }
        return null;
    }
1028485
public function getValue($field) {
        if (is_array($this->values)) {
            return isset($this->values[$field]) ? $this->values[$field] : null;
        }
        if (is_object($this->values)) {
            return $this->values->$field;
        }
        return null;
    }
764211
public function getFieldsOfType($object, $type) {
		if (!is_object($object)) {
			throw new \InvalidArgumentException('No object provided');
		}
		$fields = array();

		$classMetadata = $this->metadataFactory->getMetadataForClass(get_class($object));

		foreach ($classMetadata->propertyMetadata as $propertyMetadata) {
			if (isset($propertyMetadata->toguType) && $propertyMetadata->toguType === $type) {
				if (!is_object($object)) {
					throw new \InvalidArgumentException('No object provided');
				}
				array_push($fields, $propertyMetadata);
			}
		}

		return $fields;
	}
1326025
public function sum($field)
    {
        // prepare new query
        $q = $this->dsql()->del('fields')->del('order');

        // put field in array if it's not already
        if (!is_array($field)) {
            $field = array($field);
        }

        // add all fields to query
        foreach ($field as $f) {
            if (!is_object($f)) {
                $f = $this->getElement($f);
            }
            $q->field($q->sum($f), $f->short_name);
        }

        // return query
        return $q;
    }
429153
public function getField($field)
    {
        return isset($this->data[$field])
            ? $this->data[$field]
            : $this->searchField($field);
    }
1103067
public function toArray($object)
    {
        $this->assertObjectInstance($object);

        return array_map(
            function (Field $field) use ($object) {
                return $field->get($object);
            },
            $this->getFields()
        );
    }
810666
public static function transform_to_object( &$field ) {
		if ( 1 !== count( $field['value'] ) ) {
			return $field['value'];
		}

		$as_array = ! ( 1 === $field['min'] && 1 === $field['max'] );
		$as_array = apply_filters( Filter::REPEATER_AS_ARRAY, $as_array, $field );

		$field['value'] = $as_array ? $field['value'] : $field['value'][0];
	}
194016
public function getOne($field = null)
    {
        $row = $this->statement->fetch(PDO::FETCH_ASSOC);

        return null === $field ? $row : $row[$field];
    }
259709
public function findByObject($object, $fieldId = null)
    {
        $qb = $this->createQueryBuilder('cf');
        $this->addFindByObject($qb, 'cf', $object, $fieldId);

        return $qb->getQuery()->getResult();
    }
536148
public function mapFrom($field)
    {
        return isset($this->mapping[$field]) ? $this->mapping[$field] : $field;
    }
540510
public static function getField($field)
    {
        return isset(self::$fields[$field]) ? self::$fields[$field] : null;
    }
494775
public function eq($field, $value)
    {
        return function ($object) use ($field, $value) {
            return ClosureExpressionBuilder::getObjectFieldValue($object, $field) === $value;
        };
    }
1140465
public function getFieldData($field)
    {
        // $this->data could only be array or object, which has been checked by $this->setData
        if ((is_array($this->data) && array_key_exists($field, $this->data))
            || ($this->data instanceof \ArrayAccess && $this->data->offsetExists($field))
        ) {
            return $this->data[$field];
        } elseif (isset($this->data->$field)) {
            return $this->data->$field;
        } elseif (method_exists($this->data, 'get' . $field)) {
            return $this->data->{'get' . $field}();
        } else {
            return null;
        }
    }
664179
public function fieldQuery($field)
    {
        $query = $this->dsql()->del('fields');
        if (is_string($field)) {
            $field = $this->getElement($field);
        }
        $field->updateSelectQuery($query);

        return $query;
    }
328948
public function getFieldValue($object, $fieldName, $method = null)
    {
        $getters = [];
        // prefer method name given in the code option
        if ($method) {
            $getters[] = $method;
        }

        $camelizedFieldName = self::camelize($fieldName, true);
        $getters[] = 'get'.$camelizedFieldName;
        $getters[] = 'is'.$camelizedFieldName;

        foreach ($getters as $getter) {
            if (method_exists($object, $getter)) {
                return call_user_func([$object, $getter]);
            }
        }

        return '';
    }