Adds a field map to the queue, which will be used later when the SQL is generated

@param FieldMap $fm
512367
public function AddFieldMap($fm)
	{
		$tablealias = $fm->TableName;
		if (!array_key_exists($tablealias, $this->Tables)) $this->Tables[$tablealias] = $fm->TableName;
		
		// debugging sequence of loading tables
		// print "<div>QueryBuilder->AddFieldMap:" . $tablealias . "-&gt;" . $fm->ColumnName . "</div>";
		
		$this->Columns[$tablealias ."-". $fm->ColumnName] = $fm->FieldType == FM_CALCULATION 
			? $fm->ColumnName 
			: "`" . $tablealias . "`.`" . $fm->ColumnName . "` as `" . $fm->ColumnName . "___" . $fm->TableName . "___" . $this->_counter++ . "`";
	}
435655
function generateAddFieldSql( $table, $field_name, $added_field, $params )
    {
        return $this->OtherSchema->generateAddFieldSql( $table, $field_name, $added_field, $params );
    }
361132
public function mapField(array $mapping)
    {
        if (isset($this->fieldMappings[$mapping['fieldName']])) {
            throw MappingException::duplicateFieldMapping($this->className, $mapping['fieldName']);
        }
        $this->fieldMappings[$mapping['fieldName']] = $mapping;
    }
1277490
public function addQueryFields($fields)
    {
        /** @var DMSDocument $doc */
        $doc = singleton('DMSDocument');
        /** @var FormField $field */
        $dmsDocFields = $doc->scaffoldSearchFields(array('fieldClasses' => true));
        $membersMap = Member::get()->map('ID', 'Name')->toArray();
        asort($membersMap);

        foreach ($dmsDocFields as $field) {
            if ($field instanceof ListboxField) {
                $map = ($field->getName() === 'Tags__ID') ? $doc->getAllTagsMap() : $membersMap;
                $field->setMultiple(true)->setSource($map);

                if ($field->getName() === 'Tags__ID') {
                    $field->setRightTitle(
                        _t(
                            'DMSDocumentSet.TAGS_RIGHT_TITLE',
                            'Tags can be set in the taxonomy area, and can be assigned when editing a document.'
                        )
                    );
                }
            }
        }
        $keyValPairs = DMSJsonField::create('KeyValuePairs', $dmsDocFields->toArray());

        // Now lastly add the sort fields
        $sortedBy = FieldGroup::create('SortedBy', array(
            DropdownField::create('SortBy', '', array(
                'LastEdited'  => 'Last changed',
                'Created'     => 'Created',
                'Title'       => 'Document title',
            ), 'LastEdited'),
            DropdownField::create(
                'SortByDirection',
                '',
                array(
                    'DESC' => _t('DMSDocumentSet.DIRECTION_DESCENDING', 'Descending'),
                    'ASC' => _t('DMSDocumentSet.DIRECTION_ASCENDING', 'Ascending')
                ),
                'DESC'
            ),
        ));

        $sortedBy->setTitle(_t('DMSDocumentSet.SORTED_BY', 'Sort the document set by:'));
        $fields->addFieldsToTab(
            'Root.QueryBuilder',
            array(
                LiteralField::create(
                    'GridFieldNotice',
                    '<p class="message warning">' . _t(
                        'DMSDocumentSet.QUERY_BUILDER_NOTICE',
                        'The query builder provides the ability to add documents to a document set based on the ' .
                        'filters below. Please note that the set will be built using this criteria when you save the ' .
                        'form. This set will not be dynamically updated (see the documentation for more information).'
                    ) . '</p>'
                ),
                $keyValPairs,
                $sortedBy
            )
        );
    }
413159
private void addFieldTermReferences(Set<String> termSet) {
        Map<String, Set<String>> fieldTermRefsMap = new HashMap<String, Set<String>>();
        fieldTermRefsMap.put(m_fieldName, termSet);
        m_dbTran.addTermReferences(m_tableDef, m_tableDef.getShardNumber(m_dbObj), fieldTermRefsMap);
    }
136657
public function setFieldList($field_list = array())
    {
        if (empty($field_list)) $this->_field_list = array('*');
        $this->_field_list = (array)$field_list;

        return $this;
    }
376067
protected function setField($field_id)
    {
        $this->data_field = array();

        if (is_numeric($field_id)) {

            $conditions = array(
                'language' => 'und',
                'field_id' => $field_id
            );

            $this->data_field = $this->field->get($conditions);

            if (empty($this->data_field)) {
                $this->outputHttpStatus(404);
            }

            $this->prepareField($this->data_field);
        }
    }
999617
public function add(FieldTypeInterface $field): FormBuilderInterface
    {
        /** @var BaseType $field */
        $opts = $this->validateOptions(array_merge([
            'errors' => $this->form->getOption('errors'),
            'theme' => $this->form->getOption('theme')
        ], $field->getOptions()), $field);
        $field->setLocale($this->form->getLocale());
        $field->setOptions($opts);
        $field->setForm($this->form);
        $field->setViewFactory($this->form->getViewer());
        $field->setResourceTransformerFactory($this->form->getResourceTransformerFactory());

        // DTO
        if (! is_null($this->dataClass) && is_object($this->dataClass) && $field->getOption('mapped')) {
            $this->dataMapperManager->mapFromObjectToField($this->dataClass, $field);
        }

        // Check if section instance already exists on the form.
        // If not, create a new section instance.
        if ($this->form->repository()->hasGroup($field->getOption('group'))) {
            // The section/group instance is already registered, just fetch it.
            $section = $this->form->repository()->getGroup($field->getOption('group'));
        } else {
            // No defined group. Let's create an instance so we can attach
            // the field to it right after.
            $section = new Section($field->getOption('group'));
        }

        // Setup group/section default view.
        $section->setTheme($this->form->getTheme());
        $section->setView('form.group');

        // Add the field first to section instance.
        // Then pass both objects to the repository.
        $section->addItem($field);
        $this->form->repository()->addField($field, $section);

        return $this;
    }
1291087
@Override
    public void addValuesForField() {
        FieldDefinition fieldDef = m_tableDef.getFieldDef(m_fieldName);
        if (fieldDef == null || !fieldDef.isCollection()) {
            addSVScalar();
        } else {
            addMVScalar();
        }
    }
1199523
private void addTermColumns(String fieldValue) {
        Set<String> termSet = tokenize(fieldValue);
        indexTerms(termSet);
        addFieldTermReferences(termSet);
        addFieldReference();
    }
1154910
public function setFieldMapping($fieldMapping)
    {
        if (!\is_array($fieldMapping)) {
            throw new \InvalidArgumentException('The field mapping must be an array');
        }

        $this->fieldMapping = $fieldMapping;

        $this->type = $this->type ?: $fieldMapping['type'];
        $this->mappingType = $this->mappingType ?: $fieldMapping['type'];
        $this->fieldName = $this->fieldName ?: $fieldMapping['fieldName'];
    }
102138
function create_new_field_keys( &$field )
	{
		// update key
		$field['key'] = 'field_' . uniqid();
		
		
		if( isset($field['sub_fields']) && is_array($field['sub_fields']) )
		{
			foreach( $field['sub_fields'] as $f )
			{
				$this->create_new_field_keys( $f );
			}
		}
		elseif( isset($field['layouts']) && is_array($field['layouts']) )
		{
			foreach( $field['layouts'] as $layout )
			{
				if( isset($layout['sub_fields']) && is_array($layout['sub_fields']) )
				{
					foreach( $layout['sub_fields'] as $f )
					{
						$this->create_new_field_keys( $f );
					}
				}
				
			}
		}
	}
1313230
public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data)
    {
        $fieldDefinition = $data->fieldDefinition;
        $formConfig = $fieldForm->getConfig();

        $metasConfig = $this->configResolver->getParameter('fieldtype_metas', 'nova_ezseo');

        if (empty($data->value->metas)) {
            foreach ($metasConfig as $key => $meta) {
                $data->value->metas[$key] = new Meta($key, '');
            }
        }

        $fieldForm
            ->add(
                $formConfig->getFormFactory()->createBuilder()
                    ->create('value', MetasFieldType::class, [
                        'required' => $fieldDefinition->isRequired,
                        'label' => $fieldDefinition->getName($formConfig->getOption('languageCode')),
                    ])
                    ->setAutoInitialize(false)
                    ->getForm()
            );
    }
638747
public function updateCMSFields(FieldList $fields)
    {
        // Insert Meta Tab:
        
        $fields->insertAfter(
            Tab::create(
                'Meta',
                $this->owner->getMetaTabTitle()
            ),
            'Main'
        );
        
        // Iterate Meta Field Configuration:
        
        foreach ($this->owner->getMetaFieldConfig() as $name => $spec) {
            
            if ($spec) {
                
                // Initialise:
                
                $params = [];
                $before = null;
                $method = "getMeta{$name}Fields";
                
                // Determine Specification Type:
                
                if (is_array($spec)) {
                    $tab    = isset($spec['tab'])    ? $spec['tab']    : 'Root.Meta';
                    $method = isset($spec['method']) ? $spec['method'] : "getMeta{$name}Fields";
                    $before = isset($spec['before']) ? $spec['before'] : null;
                    $params = isset($spec['params']) ? $spec['params'] : [];
                } else {
                    $tab = $spec;
                }
                
                // Add Fields to Specified Tab:
                
                if ($this->owner->hasMethod($method)) {
                    $fields->addFieldsToTab($tab, $this->owner->$method($params), $before);
                }
                
            }
            
        }
        
        // Remove Meta Tab (if empty):
        
        if (!$fields->fieldByName('Root.Meta')->getChildren()->exists()) {
            $fields->removeFieldFromTab('Root', 'Meta');
        }
    }
1253203
private function buildFieldMappings(Mapping\ClassMetadata $metadata)
    {
        $tableName      = $metadata->getTableName();
        $columns        = $this->tables[$tableName]->getColumns();
        $primaryKeys    = $this->getTablePrimaryKeys($this->tables[$tableName]);
        $foreignKeys    = $this->getTableForeignKeys($this->tables[$tableName]);
        $allForeignKeys = [];

        foreach ($foreignKeys as $foreignKey) {
            $allForeignKeys = array_merge($allForeignKeys, $foreignKey->getLocalColumns());
        }

        $ids = [];

        foreach ($columns as $column) {
            if (in_array($column->getName(), $allForeignKeys, true)) {
                continue;
            }

            $fieldName     = $this->getFieldNameForColumn($tableName, $column->getName(), false);
            $fieldMetadata = $this->convertColumnAnnotationToFieldMetadata($tableName, $column, $fieldName);

            if ($primaryKeys && in_array($column->getName(), $primaryKeys, true)) {
                $fieldMetadata->setPrimaryKey(true);

                $ids[] = $fieldMetadata;
            }

            $metadata->addProperty($fieldMetadata);
        }

        // We need to check for the columns here, because we might have associations as id as well.
        if ($ids && count($primaryKeys) === 1) {
            $ids[0]->setValueGenerator(new Mapping\ValueGeneratorMetadata(Mapping\GeneratorType::AUTO));
        }
    }
28998
public function add_field($field, $table, $alias = null) {
        $field = self::resolve_field($field, $table);
        if (!empty($alias)) {
            $field .= ' AS ' . $alias;
        }
        $this->fields[] = $field;
    }
182495
public function addField(Field $field, $key = null)
    {
        $this->fields[$key] = $field;

        return $this;
    }