From d1e0f1afd57aac6ce222557255d3a287e1a947f4 Mon Sep 17 00:00:00 2001 From: babak alizadeh Date: Sun, 10 Dec 2023 11:06:02 +0330 Subject: [PATCH] bug fix in base html template --- .gitignore | 2 + hesabixBackup/databasefiles/index.php | 1 + hesabixBackup/versions/index.php | 1 + hesabixCore/src/Command/HesabixCommand.php | 44 +++++++++++++++++++ .../src/Controller/AdminController.php | 27 ++++++++++++ hesabixCore/templates/base.html.twig | 2 +- hesabixCore/templates/general/guide.html.twig | 3 +- 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 hesabixBackup/databasefiles/index.php create mode 100644 hesabixBackup/versions/index.php create mode 100644 hesabixCore/src/Command/HesabixCommand.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8c8f342 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +hesabixArchive/ \ No newline at end of file diff --git a/hesabixBackup/databasefiles/index.php b/hesabixBackup/databasefiles/index.php new file mode 100644 index 0000000..a814366 --- /dev/null +++ b/hesabixBackup/databasefiles/index.php @@ -0,0 +1 @@ +addArgument('arg1', InputArgument::OPTIONAL, 'Argument description') + ->addOption('option1', null, InputOption::VALUE_NONE, 'Option description') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $arg1 = $input->getArgument('arg1'); + + if ($arg1) { + $io->note(sprintf('You passed an argument: %s', $arg1)); + } + + if ($input->getOption('option1')) { + // ... + } + + $io->success('You have a new command! Now make it your own! Pass --help to see your options.'); + + return Command::SUCCESS; + } +} diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php index f78da2b..f222346 100644 --- a/hesabixCore/src/Controller/AdminController.php +++ b/hesabixCore/src/Controller/AdminController.php @@ -356,4 +356,31 @@ class AdminController extends AbstractController } throw $this->createNotFoundException(); } + + /** + * @throws Exception + */ + #[Route('/test', name: 'app_admin_database_backup_create')] + public function app_admin_database_backup_create(KernelInterface $kernel):JsonResponse + { + $application = new Application($kernel); + $application->setAutoExit(false); + + $input = new ArrayInput([ + 'command' => 'doctrine:schema:create', + // (optional) define the value of command arguments + '--dump-sql' => true, + '../../hesabixBackup/databaseFiles/file.sql'=>true, + + ]); + + // You can use NullOutput() if you don't need the output + $output = new BufferedOutput(); + $application->run($input, $output); + // return the output, don't use if you used NullOutput() + $content = $output->fetch(); + return $this->json([ + 'message' => $content, + ]); + } } diff --git a/hesabixCore/templates/base.html.twig b/hesabixCore/templates/base.html.twig index 8aca6cb..7f934f8 100644 --- a/hesabixCore/templates/base.html.twig +++ b/hesabixCore/templates/base.html.twig @@ -238,7 +238,7 @@ درباره حسابیکس
  • - + قوانین ارائه خدمات
  • diff --git a/hesabixCore/templates/general/guide.html.twig b/hesabixCore/templates/general/guide.html.twig index e97f77d..697bb80 100644 --- a/hesabixCore/templates/general/guide.html.twig +++ b/hesabixCore/templates/general/guide.html.twig @@ -1,5 +1,6 @@ {% extends "base.html.twig" %} -{% block title %}راهنما{% endblock %} +{% block title %}راهنمای بخش {% if items | length != 0 %}{{ items.0.cat }}{% endif %}{% endblock %} +{% block description %}{{ block('title') }}{% endblock %} {% block body %}