code: public function getCompanionId()
      {
          if ($this->isForeign && isset($this->foreignPrimaryKey)) {
              return $this->foreignPrimaryKey;
          } elseif (!$this->isForeign && isset($this->localPrimaryKey)) {
              return $this->localPrimaryKey;
          }
          if (isset($this->companionObject)) {
              return $this->companionObject->primaryKey;
          }
  
          return;
      }
docs: Get companion.
  
  @return [[@doctodo return_type:getCompanionId]] [[@doctodo return_description:getCompanionId]]