/** * 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()]); }
/** * 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()]); }