コード例 #1
0
ファイル: ModelAppConnections.php プロジェクト: AtuinCMS/apps
 /**
  * Inserts a new connection from an App into any other
  * section of Atuin. It will be used to store the App
  * dependences into the system.
  *
  * @param $event
  */
 public function insertConnectionFromFilter($event)
 {
     if (is_null($event->data)) {
         return;
     }
     $app = $event->data;
     $sender = $event->sender;
     $newConnection = new AppConnections();
     $newConnection->app_id = $app->id;
     $newConnection->type = $sender::className();
     $newConnection->reference_id = $sender->id;
     $newConnection->save();
 }
コード例 #2
0
 /**
  * Creates the Config files each time an App Config installation is launched
  */
 protected function createConfigFiles()
 {
     // First check if we can launch the config files creation
     if (!is_null(Yii::$app->db->schema->getTableSchema(Config::tableName(), TRUE)) && !is_null(Yii::$app->db->schema->getTableSchema(AppConnections::tableName(), TRUE))) {
         ConfigFilesManager::generateConfigFiles();
     }
 }
コード例 #3
0
 /**
  * Deletes all menu items assigned to the App
  *
  *
  * @param integer $appId
  * @throws \Exception
  */
 public function deleteAppMenuItems($appId)
 {
     /** @var MenuItem[] $menusList */
     // 1 - we get all the menus connected to the App
     $menusList = MenuItem::find()->joinWith('appConnections', FALSE)->where(['app_id' => $appId])->all();
     foreach ($menusList as $menuItem) {
         $menuItem->delete();
     }
     AppConnections::deleteAll(['app_id' => $appId, 'type' => MenuItem::className()]);
 }
コード例 #4
0
ファイル: ModelConfig.php プロジェクト: AtuinCMS/config
 /**
  * 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()]);
 }
コード例 #5
0
ファイル: Config.php プロジェクト: AtuinCMS/config
 /**
  * Returns all the connections of the Apps in the AppConnections Active Record
  *
  * Useful to retrieve all the configs, pages and extra data that Apps have
  *
  *
  * @return \yii\db\ActiveQuery
  */
 public function getAppConnections()
 {
     return $this->hasMany(AppConnections::className(), ['reference_id' => 'id']);
 }
コード例 #6
0
 private function appConnectionsTableName()
 {
     return \atuin\apps\models\AppConnections::tableName();
 }