title: Yii2 database session - store additional attributes and user information
body: <p>I'm using Yii2's <a href="http://www.yiiframework.com/doc-2.0/yii-web-dbsession.html" rel="nofollow">DBSession</a> class to store web application sessions into a database table, called <code>session</code>.</p>
  
  <p>This table by default only has 3 columns - <code>id</code>, <code>expire</code> and <code>data</code>.</p>
  
  <p>I'd like to store additional information into this table, like the <code>user_id</code> of a logged in user.</p>
  
  <p><strong>Edit</strong>: So there's a parent class called <a href="http://www.yiiframework.com/doc-2.0/yii-web-multifieldsession.html" rel="nofollow">yii\web\MultiFieldSession</a> but no examples about how it's used. I'll see what I can discover...</p>