Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function bootstrap($app)
 {
     parent::bootstrap($app);
     foreach (Helper::getDbConnections() as $db) {
         if (in_array($db->getDriverName(), ['mysql', 'mysqli'])) {
             $db->schemaMap = array_merge($db->schemaMap, ['mysql' => 'yii\\gii\\plus\\db\\mysql\\Schema', 'mysqli' => 'yii\\gii\\plus\\db\\mysql\\Schema']);
         }
     }
     if ($app instanceof WebApplication) {
         $this->setViewPath(Yii::getAlias('@yii/gii/views'));
     }
 }
Esempio n. 2
0
 /**
  * @param bool $refresh
  * @return JsExpression
  */
 public function getQueryNsAutoComplete($refresh = false)
 {
     $data = [];
     foreach (Helper::getDbConnections() as $id => $db) {
         $data[$id] = [];
         $schemaNames = Helper::getSchemaNames($db, $refresh);
         foreach (Helper::getModelNamespaces() as $modelNs) {
             $data[$id][] = $modelNs . '\\query\\base';
             foreach ($schemaNames as $schemaName) {
                 $data[$id][] = $modelNs . '\\' . $schemaName . '\\query\\base';
             }
             $data[$id][] = $modelNs . '\\' . $id . '\\query\\base';
             foreach ($schemaNames as $schemaName) {
                 $data[$id][] = $modelNs . '\\' . $id . '\\' . $schemaName . '\\query\\base';
             }
         }
     }
     return $this->createAutoComplete($data);
 }