Returns an array of fields. Fields can be both column fields and
association fields.

@return array $fields
552018
protected function getFieldsFromMetadata($metadata)
    {
        $fields = $metadata->fieldMappings;

        // Remove the primary key field if it's not managed manually
        if (!$metadata->isIdentifierNatural()) {
            foreach ($metadata->identifier as $oneId) {
                unset($fields[$oneId]);
            }
        }

        foreach ($metadata->associationMappings as $fieldName => $relation) {
            if (in_array($relation['type'], [ClassMetadataInfo::MANY_TO_ONE, ClassMetadataInfo::ONE_TO_MANY])) {
                $fields[$fieldName] = $relation;
            } elseif ($relation['type'] == ClassMetadataInfo::MANY_TO_MANY && (empty($relation['mappedBy']) == false  || empty($relation['inversedBy'])  == false)) {
                /*|| $relation['targetEntity'] == $relation['sourceEntity']*/
                $fields[$fieldName] = $relation;
            }
        }

        return $fields;
    }
942253
protected function getSelectedWithColumns()
    {
        $result = [];
        foreach ($this->withFields as $fieldSourceAlias => $withInfo) {
            list ($collection, $fields) = $withInfo;
            $resolvedFields = $this->resolveSelectiveFields($collection, $fields, []);
            $result = array_merge($result, $this->getSelectedColumns($resolvedFields, $fieldSourceAlias));
        }

        return $result;
    }
508079
public function getFields()
    {
        $results = [];
        if (!isset($this->data['fields'])
            || empty($this->data['fields'])
        ) {
            return $results;
        }

        $table = $this->data['name'];
        foreach ($this->data['fields'] as $field) {
            $name = $table . '_' . $field['name'];
            $results[$name] = $field;
        }

        return $results;
    }
902901
public function getFields()
    {
        $fields = array();
        if (isset($this->definition['index'])) {
            $fields[] = $this->getIndex();
        }
        if (isset($this->definition['fields'])) {
            foreach ($this->definition['fields'] as $key => $value) {
                if (!is_numeric($key)) {
                    $fields[] = $key;
                } else {
                    $fields[] = $value;
                }
            }
        }
        return $fields;
    }
1038277
public function getColumns()
    {
        $columns = array();

        foreach ($this->getComponents() as $item) {
            if ($item instanceof GridField_ColumnProvider) {
                $item->augmentColumns($this, $columns);
            }
        }

        return $columns;
    }
1096813
public function asArray()
    {
        $data = [];
        $columns = Manager::getInstance()->get($this)->getColumns();
        foreach(array_keys($columns) as $field) {
            $data[trim($field, '_')] = $this->$field;
        }
        $relations = Manager::getInstance()->get($this)->getRelations();
        foreach(array_keys($relations) as $field) {
            if ($this->$field instanceof Entity) {
                $data[trim($field, '_')] = $this->$field->asArray();
            } elseif ($this->$field instanceof RecordList) {
                $values = [];
                /** @var Entity $entity */
                foreach ($this->$field as $entity) {
                    $values[] = $entity->asArray();
                }
                $data[trim($field, '_')] = $values;
            } else {
                $data[trim($field, '_')] = $this->$field;
            }
        }
        return $data;

    }
29093
public function getProcessedFields()
    {
        $fields = array();
        foreach ($this->fields as $fieldName => $field) {
            $fields[$fieldName] = $this->getProcessedField($fieldName);
        }

        return $fields;
    }
640886
public function getFields()
    {
        $ownerClass = get_class($this->owner);
        $ownerTable = $ownerClass::tableName();
        if (!isset(self::$_fields[$ownerTable])) {
            self::$_fields[$ownerTable] = [];
            $_f = ['deletedField', 'deletedByField', 'createdField', 'createdByField', 'modifiedField', 'modifiedByField'];
            $schema = $ownerClass::getTableSchema();
            foreach ($_f as $field) {
                if (isset($schema->columns[$this->{$field}])) {
                    self::$_fields[$ownerTable][$field] = $this->{$field};
                }
            }
        }

        return self::$_fields[$ownerTable];
    }
1365483
protected function getManyFields()
    {
        $fields = $this->definition->getFieldNames(true);
        return array_filter($fields, function($field) {
            return $this->definition->getType($field) === 'many';
        });
    }
195566
protected function getFields()
    {
        if (is_null($this->fields)) {
            $columns = $this->getColumns();

            if (empty($columns)) {
                throw new Exception('The table ' . $this->tableName . ' was not found in the ' . $this->databaseName . ' database.');
            }

            $this->fields = $this->transfer($columns);
        }

        return $this->fields;
    }
759013
public function get_fields()
    {
        if( !isset( $this->fields ) )
        {
            if( !$this->has_sub_sections() )
            {
                $this->fields = $this->model['fields'];
            }
            else
            {
                $this->fields = array();
                foreach( $this->model['subsections'] as $subsection )
                {
                    foreach( $subsection['fields'] as $field )
                    {
                        $field->subsection = \Amarkal\Common\Tools::strtoslug( $subsection['title'] );
                    }
                    $this->fields = array_merge( $this->fields, $subsection['fields'] );
                }
            }
        }
        return $this->fields;
    }
625222
public function getFields()
    {
        $models = array();

        /**
         * @var Form_Field $form_field
         * @var Field $model_field
         */
        foreach ($this->field_associations as $form_field => $model_field) {
            $v = $this->form->get($form_field);
            $model_field->set($v);
            if (!isset($models[$model_field->owner->name])) {
                $models[$model_field->owner->name] = $model_field->owner;
            }
        }

        return $models;
    }
406640
public function getFields(): array
    {
        $fields = $this->reflection->getSchema();

        foreach ($fields as $field => $type) {
            if ($this->isAggregation($type)) {
                unset($fields[$field]);
            }
        }

        return $fields;
    }
63210
public function getJoins()
    {
        $joins = [];

        foreach ($this->fieldDescriptors as $fieldDescriptor) {
            $joins = array_merge($joins, $fieldDescriptor->getJoins());
        }

        return $joins;
    }
1029530
public function getIdentifierColumnNames()
    {
        $columnNames = array();

        foreach ($this->identifier as $idProperty) {
            if (isset($this->fieldMappings[$idProperty])) {
                $columnNames[] = $this->fieldMappings[$idProperty]['columnName'];

                continue;
            }

            // Association defined as Id field
            $joinColumns      = $this->associationMappings[$idProperty]['joinColumns'];
            $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns);

            $columnNames = array_merge($columnNames, $assocColumnNames);
        }

        return $columnNames;
    }
1099388
protected function get_fieldlist() : array {
        global $DB;

        if (null === $this->fields) {
            $fields = [];
            foreach (array_keys($DB->get_columns($this->tablename)) as $fieldname) {
                $fields["{$this->fieldprefix}{$fieldname}"] = $fieldname;
            }

            $this->fields = $fields;
        }

        return $this->fields;
    }
1085613
public function getFields()
    {
        $fields = FieldList::create();

        foreach ($this->fieldgroups as $group) {
            if (method_exists($this, 'get'.$group.'Fields')) {
                $fields->merge($this->{'get'.$group.'Fields'}());
            }
        }

        return $fields;
    }