コード例 #1
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()]);
 }
コード例 #2
0
 private function tableName()
 {
     return '{{%' . MenuItem::tableName() . '}}';
 }
コード例 #3
0
ファイル: MenuItems.php プロジェクト: cyneek/yii2-menu
 public function show_menu_item($name)
 {
     MenuItem::updateAll(['visible' => 1], ['name' => $name]);
 }
コード例 #4
0
ファイル: MenuItem.php プロジェクト: AtuinCMS/atuin-menus
 /**
  * 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' => \cyneek\yii2\menu\models\MenuItem::className()]);
     });
 }