init() public method

This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
public init ( )
コード例 #1
0
ファイル: Session.php プロジェクト: maddoger/yii2-user
 public function init()
 {
     if (is_string($this->db)) {
         $this->db = Yii::$app->get($this->db);
     }
     if (!$this->db instanceof Connection) {
         throw new InvalidConfigException("DbSession::db must be either a DB connection instance or the application component ID of a DB connection.");
     }
     if (!$this->sessionTable) {
         $this->sessionTable = $this->db->tablePrefix . 'session';
     }
     parent::init();
 }
コード例 #2
0
ファイル: DbSession.php プロジェクト: deesoft/yii2-tools
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->createTable();
 }