Example #1
0
 /**
  * @param null $db
  * @return mixed
  * @throws \yii\base\InvalidConfigException
  */
 public function createCommand($db = null)
 {
     if ($db === null) {
         /** @var Connection $db */
         $db = Yii::$app->get(Connection::getDriverName());
     }
     $commandConfig = $db->getQueryBuilder()->build($this);
     return $db->createCommand($commandConfig);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->actions['rest-query'] = ['class' => 'yii\\restclient\\DebugAction', 'panel' => $this, 'db' => Connection::getDriverName()];
 }
 /**
  * @return null|Connection
  * @throws InvalidConfigException
  */
 public static function getDb()
 {
     return \Yii::$app->get(Connection::getDriverName());
 }