Used to retrieve a fieldname for either field or association from a given column.

This method is used in foreign-key as primary-key contexts.

@param string $columnName

@return string

@throws MappingException
330981
public function getFieldForColumn($columnName)
    {
        if (isset($this->fieldNames[$columnName])) {
            return $this->fieldNames[$columnName];
        } else {
            foreach ($this->associationMappings as $assocName => $mapping) {
                if ($this->isAssociationWithSingleJoinColumn($assocName) &&
                    $this->associationMappings[$assocName]['joinColumns'][0]['name'] == $columnName) {

                    return $assocName;
                }
            }

            throw MappingException::noFieldNameFoundForColumn($this->name, $columnName);
        }
    }
1104523
public Optional<ColumnMapping> getColumnMapping(final String columnName) {
        return columns.stream()
                .filter(c -> c.getName() != null && c.getName().equals(columnName))
                .findFirst();
    }
554151
private function mapFieldName($fieldName)
    {
        if (isset($this->fieldNameMapping[$fieldName])) {
            $fieldName = $this->fieldNameMapping[$fieldName];
        }

        return $fieldName;
    }
926985
public function getAttributeNameForColumn($columnName)
    {
        if (!empty($this->mappings)) {
            if (isset($this->mappings[$columnName])) {
                return $this->mappings[$columnName];
            }
        }

        return $columnName;
    }
835989
public function getPrimaryColumn($tableName)
    {
        $primaryKey = $this->getPrimaryKey($tableName);
        if (empty($primaryKey)) {
            return null;
        } elseif (count($primaryKey) > 1) {
            throw new \Exception(
                'getPrimaryColumn method does not support composite primary keys, use getPrimaryKey instead'
            );
        }

        return $primaryKey[0];
    }
836800
protected function _getFieldLongName($fieldName)
    {
        //trying to avoid strpos call as often as possible
        $coreTableName = $this->getCoreTableName();
        if ($fieldName[2] == $coreTableName[2] && strpos($fieldName, $coreTableName . '__') === 0) {
            return $fieldName;
        }

        return $coreTableName . '__' . strtolower($fieldName);
    }
1321389
private function getField($fieldname)
    {
        if (array_key_exists($fieldname, $this->colmodel)) {
            return $this->colmodel[$fieldname];
        } else {
            return false;
        }
    }
345943
public function getForeignKey($constraintName)
    {
        $constraintName = $this->normalizeIdentifier($constraintName);
        if (! $this->hasForeignKey($constraintName)) {
            throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
        }

        return $this->_fkConstraints[$constraintName];
    }
960923
public static function getPdoParamName($columnName)
    {
        if (isset(self::$pdoParamAliasesUsed[$columnName])) {
            self::$pdoParamAliasesUsed[$columnName]++;

            return $columnName . self::$pdoParamAliasesUsed[$columnName];
        } else {
            self::$pdoParamAliasesUsed[$columnName] = 1;

            return $columnName;
        }
    }
634794
public function getColumn($columnKey)
    {
        $columns = $this->searchable();

        if (array_key_exists($columnKey, $columns)) {
            return $columns[$columnKey];
        }

        foreach ($columns as $column) {
            if ($column === $columnKey || ends_with($column, ".{$columnKey}")) {
                return $column;
            }
        }
    }
1354993
public static function getDbFieldName($propertyName)
    {
        if (!isset(self::$cachedDbFieldNames[$propertyName])) {
            self::$cachedDbFieldNames[$propertyName] = Str::camelToSeparator($propertyName);
        }

        return self::$cachedDbFieldNames[$propertyName];
    }
413251
public function getColumnValues($columnName = 'PrimaryKey')
    {
        $ret = [];
        $keyGetterMethod = 'get' . ucfirst($columnName);
        foreach ($this as $obj) {
            $ret[] = $obj->$keyGetterMethod();
        }

        return $ret;
    }
1076058
public function getColumnMetadata(string $columnName): ColumnMetadata
    {
        if (!array_key_exists($columnName, $this->columnMetadataList)) {
            throw new \RuntimeException('Table "' . $this->tableName . '" doesn\'t contain column "' . $columnName . '"');
        }

        return $this->columnMetadataList[$columnName];
    }
836019
public function getOwningTable($fieldName)
    {
        if (isset($this->owningTableMap[$fieldName])) {
            return $this->owningTableMap[$fieldName];
        }

        switch (true) {
            case isset($this->class->associationMappings[$fieldName]['inherited']):
                $cm = $this->em->getClassMetadata($this->class->associationMappings[$fieldName]['inherited']);
                break;

            case isset($this->class->fieldMappings[$fieldName]['inherited']):
                $cm = $this->em->getClassMetadata($this->class->fieldMappings[$fieldName]['inherited']);
                break;

            default:
                $cm = $this->class;
                break;
        }

        $tableName          = $cm->getTableName();
        $quotedTableName    = $this->quoteStrategy->getTableName($cm, $this->platform);

        $this->owningTableMap[$fieldName] = $tableName;
        $this->quotedTableMap[$tableName] = $quotedTableName;

        return $tableName;
    }
88940
public function getNamedNativeQuery($queryName)
    {
        if ( ! isset($this->namedNativeQueries[$queryName])) {
            throw MappingException::queryNotFound($this->name, $queryName);
        }

        return $this->namedNativeQueries[$queryName];
    }
102140
public function getLinkTypeColumnCallback($columnName)
    {

        // query whether or not a callback mapping is available
        if (isset($this->linkTypeAttributeColumnToCallbackMapping[$columnName])) {
            // load it from the array with the mappings
            list (, $callbackName) = $this->linkTypeAttributeColumnToCallbackMapping[$columnName];
            // prepare and return the callback
            return array($this, $callbackName);
        }

        // return the default callback
        return array($this, 'explode');
    }
807990
public function primaryKey ($tableName)
		{
			if (! isset($this->primaryKeys[$tableName])) {
				$sql = "SELECT *
					    FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc
					        JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name
					    WHERE tc.CONSTRAINT_TYPE = 'Primary Key'
					        AND tc.TABLE_NAME = " . $this->quote($tableName);

				$keyResult                      = $this->query($sql);
				$key                            = $keyResult->fetchRow();
				$this->primaryKeys[$tableName]  = $key['COLUMN_NAME'];
			}

			return $this->primaryKeys[$tableName];
		}