/** * @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); }
/** * @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()); }
/** * Запрос на удаление * * @param $id * @param array $options * @return mixed */ public function delete($id, $options = []) { $url = $this->index . '/' . $id; return $this->db->delete($url, $options); }