yii\web\User::getId PHP Метод

getId() публичный Метод

Returns a value that uniquely represents the user.
См. также: getIdentity()
public getId ( ) : string | integer
Результат string | integer the unique identifier for the user. If `null`, it means the user is a guest.
    public function getId()
    {
        $identity = $this->getIdentity();
        return $identity !== null ? $identity->getId() : null;
    }

Usage Example

Пример #1
0
 /**
  * @param string $default
  *
  * @return string
  */
 protected function getIdentifier($default)
 {
     $id = $default;
     if ($this->user instanceof User && !$this->user->getIsGuest()) {
         $id = $this->user->getId();
     }
     return $id;
 }
All Usage Examples Of yii\web\User::getId