init() public method

This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
public init ( )
Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->createTable();
 }