init() public méthode

This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
public init ( )
Exemple #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->db === null) {
         $this->db = new Connection(['dsn' => 'sqlite:' . Yii::getAlias($this->dbFile)]);
     }
     parent::init();
     if ($this->autoCreateTable && !$this->db->getTableSchema($this->cacheTable)) {
         $this->createTableCache();
     }
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->createTable();
 }