示例#1
0
 /**
  * Adds the basic module data configuration
  *
  * @param App $app_record
  */
 protected function normalizeModuleConfig($app_record)
 {
     $appConnectionsModel = new ModelAppConnections();
     Filters::registerAction([Config::className(), Config::EVENT_AFTER_INSERT], [$appConnectionsModel, 'insertConnectionFromFilter'], $app_record);
     // Adds the class to the module config
     ModelConfig::addConfig(NULL, 'modules', $app_record->app_id, 'class', $app_record->className, FALSE);
     // Adds the alias to the module config
     ModelConfig::addConfig(NULL, 'aliases', NULL, $app_record->alias, $app_record->directory, FALSE);
     Filters::unRegisterAction([Config::className(), Config::EVENT_AFTER_INSERT]);
 }
 protected function executeConfig()
 {
     $appConnectionsModel = new ModelAppConnections();
     Filters::registerAction([Config::className(), Config::EVENT_AFTER_INSERT], [$appConnectionsModel, 'insertConnectionFromFilter'], $this->app);
     // Deleting manually the already assigned configs
     if ($this->preMethod == 'down') {
         $modelConfig = new ModelConfig();
         $modelConfig->deleteAppConfigItems($this->app->id);
     }
     $methodParams = NULL;
     // Declare the parameters passed into the method
     if ($this->preMethod == 'update') {
         $methodParams = $this->app->version;
     }
     call_user_func([$this->installationObject, $this->preMethod . 'Config'], $methodParams);
     Filters::unRegisterAction([Config::className(), Config::EVENT_AFTER_INSERT]);
 }
示例#3
0
 /**
  * Deletes all config items assigned to the App
  *
  *
  * @param integer $appId
  * @throws \Exception
  */
 public static function deleteAppConfigItems($appId)
 {
     $configList = Config::find()->joinWith('appConnections', FALSE)->where(['app_id' => $appId])->all();
     foreach ($configList as $configItem) {
         $configItem->delete();
     }
     AppConnections::deleteAll(['app_id' => $appId, 'type' => Config::className()]);
 }
 protected function configsTableName()
 {
     return \atuin\config\models\Config::tableName();
 }
示例#5
0
 /**
  * Retrieves all the Configs assigned to the filtered Apps using AppConnections
  * as junction table.
  *
  * @return \yii\db\ActiveQuery
  */
 public function getApp()
 {
     return $this->hasOne(App::className(), ['id' => 'app_id'])->via('appConnections', function ($query) {
         $query->where(['type' => Config::className()]);
     });
 }
示例#6
0
文件: App.php 项目: AtuinCMS/apps
 /**
  * Retrieves all the Configs assigned to the filtered Apps using AppConnections
  * as junction table.
  *
  * @return \yii\db\ActiveQuery
  */
 public function getConfigs()
 {
     return $this->hasMany(Config::className(), ['id' => 'reference_id'])->via('appConnections', function ($query) {
         $query->where(['type' => Config::className()]);
     });
 }