getOtherKey() публичный метод

Get the associated key of the relationship.
public getOtherKey ( ) : string
Результат string
Пример #1
2
 protected function applyBelongsTo(Query $query, Model $model, BelongsTo $belongsTo, $name)
 {
     if (isset($this->joinClasses[$name])) {
         return;
     }
     $modelTable = '';
     // If the table has already an alias
     if (str_contains($name, '.')) {
         $path = explode('.', $name);
         array_pop($path);
         $parentPath = implode('.', $path);
         if (isset($this->joinAliases[$parentPath])) {
             $modelTable = $this->joinAliases[$parentPath];
         }
     }
     if (!$modelTable) {
         $modelTable = $belongsTo->getParent()->getTable();
     }
     $related = $belongsTo->getRelated();
     $relatedTable = $related->getTable();
     $foreignKey = $belongsTo->getForeignKey();
     $otherKey = $belongsTo->getOtherKey();
     $alias = $this->joinNameToAlias($name);
     $joinMethod = $this->getJoinMethod($name);
     $query->{$joinMethod}("{$relatedTable} AS {$alias}", "{$modelTable}.{$foreignKey}", '=', "{$alias}.{$otherKey}");
     $query->distinct();
     $this->addQueryColumn("{$modelTable}.{$foreignKey}");
     $this->joinClasses[$name] = $belongsTo->getRelated();
     $this->joinTable[$name] = $relatedTable;
     $this->joinAliases[$name] = $alias;
 }