code: public function getId()
      {
          if ($this->isForeign) {
              if (isset($this->foreignPrimaryKey)) {
                  return $this->foreignPrimaryKey;
              } elseif (isset($this->foreignObject)) {
                  return $this->foreignObject->primaryKey;
              }
          } else {
              if (isset($this->localPrimaryKey)) {
                  return $this->localPrimaryKey;
              } elseif (isset($this->localObject)) {
                  return $this->localObject->primaryKey;
              }
          }
          if (isset($this->primaryObject)) {
              return $this->primaryObject->primaryKey;
          }
  
          return;
      }
docs: Get id.
  
  @return [[@doctodo return_type:getId]] [[@doctodo return_description:getId]]