title: Yii2 login. Yii::$app->user->login($user, 0) doesnt save
body: <p>I am trying implement login at my site. But seems like <code>Yii::$app-&gt;user-&gt;login($user, 0)</code> doesn't save identity.</p>
  
  <p>When I've just logged in it work fine: </p>
  
  <pre><code>    if (Yii::$app-&gt;user-&gt;login($user, 0) ) {
          var_dump(Yii::$app-&gt;user-&gt;identity);
      } else {
          echo 'didnt login';
      }
  </code></pre>
  
  <p><code>var_dump()</code> show identity. </p>
  
  <p>But when I am trying obtain identity in another controller <code>var_dump()</code> shows <code>NULL</code>:</p>
  
  <pre><code>// In other controller
  var_dump(Yii::$app-&gt;user-&gt;identity);
  </code></pre>
  
  <p>Does somebody know about this problem?</p>