Beispiel #1
0
 /**
  * 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();
 }
 /**
  * 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();
     }
 }
Beispiel #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()]);
 }
Beispiel #4
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()]);
 }
Beispiel #5
0
 /**
  * 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']);
 }
 private function appConnectionsTableName()
 {
     return \atuin\apps\models\AppConnections::tableName();
 }