Returns the foreign key.

@return string
182674
protected function getForeignKey()
	{
		if($this->foreignKey === null)
		{
			$this->foreignKey = $this->parent->getForeignKey();
		}

		return $this->foreignKey;
	}
265605
public function getLink() {
		if($this->get('many') && $this->type() == 'hasMany')
			return $this->reverse()->get('name').'_id';
		elseif(!$this->get('many'))
			return $this->name.'_id';
	}
469639
protected function getKeyName()
    {
        if (is_null($this->form)) {
            return;
        }

        return $this->form->model()->{$this->relationName}()->getRelated()->getKeyName();
    }
1224175
public function primaryKey()
    {
        $primaryKeys = [];
        foreach ($this->_columns as $name => $data) {
            if ((!array_key_exists('primaryKey', $data)) || ($data['primaryKey'] !== true)) {
                continue;
            }

            $primaryKeys[] = $name;
        }

        return $primaryKeys;
    }
698730
public function getForeignKey()
    {
        if (is_null($this->_foreignKey)) {
            $this->setForeignKey($this->_guessForeignKey());
        }
        return $this->_foreignKey;
    }
1185193
public function getForeignKey()
    {
        if ($this->_foreignKey === null) {
            $this->_foreignKey = $this->_modelKey($this->getSource()->getAlias());
        }

        return $this->_foreignKey;
    }
993041
public function key()
    {
        if (isset($this->keys[$this->pos])) {
            return $this->keys[$this->pos];
        }
        return null;
    }
119648
private function getKey()
    {
        if ($this->_key === null) {
            $this->_key = ftok(__FILE__, $this->id);
        }

        return $this->_key;
    }
1161299
public function key()
    {
        if ($this->type == self::PAIRS) {
            return $this->current->key;
        } else {
            return $this->index;
        }
    }
219644
public function getKeyValue()
    {
        if (array_key_exists($this->primary_key, $this->original)) {
            return $this->original[$this->primary_key];
        }

        return null;
    }
586933
public function getKey(): string
    {
        if ($this->key) {
            return $this->key;
        }

        if ($this->config->has('key')) {
            $key = Key::validate($this->config->get('key'), 'group');

            $this->key = $key;

            return $key;
        }

        $this->key = Key::sanitize($this->config->get('title'));

        return $this->key;
    }
351152
public function getPrimaryKeyForForeignModel()
    {
        $model = $this->getForeignModelInstance();

        if ($this->isModel($model)) {
            return $model->getKeyName();
        }

        return $this->getKeyNameFromResource() ?: 'id';
    }
729302
public function getPrimaryKey() {
        if ($this->primaryKey === null) {
            $schema = $this->getSchema();

            $pk = [];
            foreach ($schema->getSchemaArray()['properties'] as $column => $property) {
                if (!empty($property['primary'])) {
                    $pk[] = $column;
                }
            }
            $this->primaryKey = $pk;
        }
        return $this->primaryKey;
    }
732181
public function getAllForeignKeys()
    {
        $columns = array();
        foreach ($this->getColumns() as $column) {
            foreach ($column->getForeignKeys() as $foreignKey) {
                if (array_key_exists($foreignKey->getId(), $columns)) {
                    continue;
                }
                $columns[$foreignKey->getId()] = $foreignKey;
            }
        }

        return $columns;
    }
990659
public function getPrimaryKey()
    {
        if (null === $this->primary) {
            $metadata = $this->getMetadata();
            $constraints = $metadata->getConstraints($this->getTable());

            foreach ($constraints as $constraint) {
                if ($constraint->getType() == 'PRIMARY KEY') {
                    $this->primary = $constraint->getColumns();
                }
            }
        }

        return $this->primary;
    }
985263
public function getRelatedForeignKey()
    {
        if (null == $this->relatedForeignKey) {
            $name = $this->getParentTableName();
            $this->relatedForeignKey = "{$this->normalizeFieldName($name)}_id";
        }
        return $this->relatedForeignKey;
    }
643795
public function getKey(): string
    {
        if (null === $this->name) {
            return $this->type;
        }

        return $this->type . '#' . $this->name;
    }