menuService = new MenuService(); $this->consoleService = new ConsoleService(); $this->migrationService = new MigrationService(); } /** * @throws \Exception */ public function init(): void { $this->migrationService->runAtPath("{KERNEL_APP_MODULES}/card/migrations"); $this->consoleService->runComposerRequire("dragon-code/card-number"); $this->consoleService->runComposerRequire("endroid/qr-code"); $this->menuService->createItem([ "label" => "Card", "url" => "/admin/card", "slug" => "card", ]); $this->menuService->createItem([ "label" => "Список карт", "url" => "/admin/card", "slug" => "card_list", "parent_slug" => "card" ]); $this->menuService->createItem([ "label" => "Шаблоны карт", "url" => "/admin/card_template", "slug" => "card_template", "parent_slug" => "card" ]); } /** * @throws \Exception */ public function deactivate(): void { $this->menuService->removeItemBySlug("card"); $this->menuService->removeItemBySlug("card_list"); $this->menuService->removeItemBySlug("card_template"); $this->migrationService->rollbackAtPath("{KERNEL_APP_MODULES}/card/migrations"); $this->consoleService->runComposerRemove("dragon-code/card-number"); $this->consoleService->runComposerRemove("endroid/qr-code"); } }