From becb8b4521eb474e56d367b3f51390c5e3bf7588 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Sun, 31 Aug 2025 11:08:15 +0200 Subject: [PATCH 01/10] 4565: Added update command --- CHANGELOG.md | 3 +- src/Command/TemplatesListCommand.php | 36 ++++++++++--- src/Command/UpdateCommand.php | 80 ++++++++++++++++++++++++++-- 3 files changed, 108 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c2777af..fcebe13f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ All notable changes to this project will be documented in this file. * Removed propTypes. * Upgraded redux-toolkit and how api slices are generated. * Fixed redux-toolkit cache handling. -* Add Taskfile +* Added Taskfile +* Added update command. ### NB! Prior to 3.x the project was split into separate repositories diff --git a/src/Command/TemplatesListCommand.php b/src/Command/TemplatesListCommand.php index 4466c9d2..c19c2321 100644 --- a/src/Command/TemplatesListCommand.php +++ b/src/Command/TemplatesListCommand.php @@ -9,6 +9,7 @@ use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -24,10 +25,17 @@ public function __construct( parent::__construct(); } + protected function configure(): void + { + $this->addOption('status', 's', InputOption::VALUE_NONE, 'Get status of installed templates.'); + } + final protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); + $status = $input->getOption('status'); + try { $templates = $this->templateService->getCoreTemplates(); @@ -39,12 +47,28 @@ final protected function execute(InputInterface $input, OutputInterface $output) $customTemplates = $this->templateService->getCustomTemplates(); - $io->table(['ID', 'Title', 'Status', 'Type'], array_map(fn (TemplateData $templateData) => [ - $templateData->id, - $templateData->title, - $templateData->installed ? 'Installed' : 'Not Installed', - $templateData->type, - ], array_merge($templates, $customTemplates))); + $allTemplates = array_merge($templates, $customTemplates); + + if ($status) { + $numberOfTemplates = count($allTemplates); + $numberOfInstallledTemplates = count(array_filter($allTemplates, fn ($entry) => $entry->installed)); + $text = $numberOfInstallledTemplates.' / '.$numberOfTemplates.' templates installed.'; + + if ($numberOfInstallledTemplates === $numberOfTemplates) { + $io->success($text); + } else { + $io->warning($text); + + return Command::FAILURE; + } + } else { + $io->table(['ID', 'Title', 'Status', 'Type'], array_map(fn (TemplateData $templateData) => [ + $templateData->id, + $templateData->title, + $templateData->installed ? 'Installed' : 'Not Installed', + $templateData->type, + ], $allTemplates)); + } return Command::SUCCESS; } catch (\Exception $e) { diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index 9e85424c..1592c1c2 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -4,9 +4,81 @@ namespace App\Command; -class UpdateCommand +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +#[AsCommand( + name: 'app:update', + description: 'Check if important commands have been run. Use --force to run the commands.', +)] +class UpdateCommand extends Command { - // TODO: Test that migrations have been run. - // TODO: Run test of status for templates. No templates = clean install. Install all? - // TODO: Update existing templates. + protected function configure(): void + { + $this->addOption('force', 'f', InputOption::VALUE_NONE, 'Update all requirements. Otherwise, update command only checks requirements.'); + } + + final protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + + $force = $input->getOption('force'); + + if ($force) { + // Run migrations. + $migrationsCommand = new ArrayInput([ + 'command' => 'doctrine:migrations:migrate', + ]); + $migrationsCommand->setInteractive(false); + $this->getApplication()->doRun($migrationsCommand, $output); + + // Install all templates. + $migrationsCommand = new ArrayInput([ + 'command' => 'app:templates:install', + '--all' => true, + '--update' => true, + ]); + $migrationsCommand->setInteractive(false); + $this->getApplication()->doRun($migrationsCommand, $output); + } else { + $io->title('Migrations status'); + + // Check status for migrations. + $command = new ArrayInput([ + 'command' => 'doctrine:migrations:up-to-date', + ]); + $result = $this->getApplication()->doRun($command, $output); + + if (0 !== $result) { + $io->info('Run doctrine:migrations:migrate to migrate to latest migration.'); + + return Command::FAILURE; + } + + $io->writeln(''); + $io->writeln(''); + $io->writeln(''); + $io->title('Templates status'); + + // List status for templates. + $command = new ArrayInput([ + 'command' => 'app:templates:list', + '--status' => true, + ]); + $result = $this->getApplication()->doRun($command, $output); + + if (0 !== $result) { + $io->info('Run app:templates:install to install missing templates.'); + + return Command::FAILURE; + } + } + + return Command::SUCCESS; + } } From d51484c2a1f2dbe5bcac881a1af6aa28e7000e80 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Sun, 31 Aug 2025 11:15:05 +0200 Subject: [PATCH 02/10] 4565: Fixed issues raised by psalm --- src/Command/TemplatesListCommand.php | 2 +- src/Command/UpdateCommand.php | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Command/TemplatesListCommand.php b/src/Command/TemplatesListCommand.php index c19c2321..c97471cc 100644 --- a/src/Command/TemplatesListCommand.php +++ b/src/Command/TemplatesListCommand.php @@ -51,7 +51,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) if ($status) { $numberOfTemplates = count($allTemplates); - $numberOfInstallledTemplates = count(array_filter($allTemplates, fn ($entry) => $entry->installed)); + $numberOfInstallledTemplates = count(array_filter($allTemplates, fn ($entry): bool => $entry->installed)); $text = $numberOfInstallledTemplates.' / '.$numberOfTemplates.' templates installed.'; if ($numberOfInstallledTemplates === $numberOfTemplates) { diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index 1592c1c2..50223e3b 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -29,13 +29,20 @@ final protected function execute(InputInterface $input, OutputInterface $output) $force = $input->getOption('force'); + $application = $this->getApplication(); + + if ($application === null) { + $io->error('Application not initialized.'); + return Command::FAILURE; + } + if ($force) { // Run migrations. $migrationsCommand = new ArrayInput([ 'command' => 'doctrine:migrations:migrate', ]); $migrationsCommand->setInteractive(false); - $this->getApplication()->doRun($migrationsCommand, $output); + $application->doRun($migrationsCommand, $output); // Install all templates. $migrationsCommand = new ArrayInput([ @@ -44,7 +51,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) '--update' => true, ]); $migrationsCommand->setInteractive(false); - $this->getApplication()->doRun($migrationsCommand, $output); + $application->doRun($migrationsCommand, $output); } else { $io->title('Migrations status'); @@ -52,7 +59,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) $command = new ArrayInput([ 'command' => 'doctrine:migrations:up-to-date', ]); - $result = $this->getApplication()->doRun($command, $output); + $result = $application->doRun($command, $output); if (0 !== $result) { $io->info('Run doctrine:migrations:migrate to migrate to latest migration.'); @@ -70,7 +77,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) 'command' => 'app:templates:list', '--status' => true, ]); - $result = $this->getApplication()->doRun($command, $output); + $result = $application->doRun($command, $output); if (0 !== $result) { $io->info('Run app:templates:install to install missing templates.'); From 674bb1e5ef3ce1e024b1994077ae123af83a953b Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Sun, 31 Aug 2025 11:18:51 +0200 Subject: [PATCH 03/10] 4565: Applied coding standards --- src/Command/UpdateCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index 50223e3b..e1688e6f 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -31,8 +31,9 @@ final protected function execute(InputInterface $input, OutputInterface $output) $application = $this->getApplication(); - if ($application === null) { + if (null === $application) { $io->error('Application not initialized.'); + return Command::FAILURE; } From c80f09735c52f79dd5b15d3905df4ab286b71178 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 15:01:03 +0200 Subject: [PATCH 04/10] 4565: Cleaned up commands --- src/Command/StatusCommand.php | 67 ++++++++++++++++++++ src/Command/TemplatesListCommand.php | 8 +-- src/Command/TemplatesUpdateCommand.php | 43 +++++++++++++ src/Command/UpdateCommand.php | 87 ++++++++++++-------------- src/Service/TemplateService.php | 14 +++++ 5 files changed, 164 insertions(+), 55 deletions(-) create mode 100644 src/Command/StatusCommand.php create mode 100644 src/Command/TemplatesUpdateCommand.php diff --git a/src/Command/StatusCommand.php b/src/Command/StatusCommand.php new file mode 100644 index 00000000..6b8464c4 --- /dev/null +++ b/src/Command/StatusCommand.php @@ -0,0 +1,67 @@ +getApplication(); + + if (null === $application) { + $io->error('Application not initialized.'); + + return Command::FAILURE; + } + + $io->title('Migrations status'); + + // Check status for migrations. + $command = new ArrayInput([ + 'command' => 'doctrine:migrations:up-to-date', + ]); + $result = $application->doRun($command, $output); + + if (0 !== $result) { + $io->info('Run doctrine:migrations:migrate to migrate to latest migration.'); + + return Command::FAILURE; + } + + $io->writeln(''); + $io->writeln(''); + $io->writeln(''); + $io->title('Templates status'); + + // List status for templates. + $command = new ArrayInput([ + 'command' => 'app:templates:list', + '--status' => true, + ]); + $result = $application->doRun($command, $output); + + if (0 !== $result) { + $io->info('Run app:templates:install to install missing templates.'); + + return Command::FAILURE; + } + + return Command::SUCCESS; + } +} diff --git a/src/Command/TemplatesListCommand.php b/src/Command/TemplatesListCommand.php index c97471cc..849758fa 100644 --- a/src/Command/TemplatesListCommand.php +++ b/src/Command/TemplatesListCommand.php @@ -54,13 +54,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) $numberOfInstallledTemplates = count(array_filter($allTemplates, fn ($entry): bool => $entry->installed)); $text = $numberOfInstallledTemplates.' / '.$numberOfTemplates.' templates installed.'; - if ($numberOfInstallledTemplates === $numberOfTemplates) { - $io->success($text); - } else { - $io->warning($text); - - return Command::FAILURE; - } + $io->success($text); } else { $io->table(['ID', 'Title', 'Status', 'Type'], array_map(fn (TemplateData $templateData) => [ $templateData->id, diff --git a/src/Command/TemplatesUpdateCommand.php b/src/Command/TemplatesUpdateCommand.php new file mode 100644 index 00000000..d2e67776 --- /dev/null +++ b/src/Command/TemplatesUpdateCommand.php @@ -0,0 +1,43 @@ +templateService->getAllTemplates(); + + foreach ($templates as $templateToUpdate) { + $this->templateService->updateTemplate($templateToUpdate); + } + + $io->success('Updated all installed templates'); + + return Command::SUCCESS; + } +} diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index e1688e6f..8ce0bead 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -4,30 +4,34 @@ namespace App\Command; +use App\Service\TemplateService; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand( name: 'app:update', - description: 'Check if important commands have been run. Use --force to run the commands.', + description: 'Run required updates.', )] class UpdateCommand extends Command { - protected function configure(): void + private TemplateService $templateService; + + public function __construct(TemplateService $templateService, ?string $name = null) { - $this->addOption('force', 'f', InputOption::VALUE_NONE, 'Update all requirements. Otherwise, update command only checks requirements.'); + parent::__construct($name); + $this->templateService = $templateService; } + final protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - - $force = $input->getOption('force'); + $isInteractive = $input->isInteractive(); $application = $this->getApplication(); @@ -37,54 +41,41 @@ final protected function execute(InputInterface $input, OutputInterface $output) return Command::FAILURE; } - if ($force) { - // Run migrations. - $migrationsCommand = new ArrayInput([ - 'command' => 'doctrine:migrations:migrate', - ]); - $migrationsCommand->setInteractive(false); - $application->doRun($migrationsCommand, $output); - - // Install all templates. - $migrationsCommand = new ArrayInput([ - 'command' => 'app:templates:install', - '--all' => true, - '--update' => true, - ]); - $migrationsCommand->setInteractive(false); - $application->doRun($migrationsCommand, $output); - } else { - $io->title('Migrations status'); + $command = new ArrayInput([ + 'command' => 'doctrine:migrations:migrate', + ]); + $command->setInteractive($isInteractive); + $result = $application->doRun($command, $output); - // Check status for migrations. - $command = new ArrayInput([ - 'command' => 'doctrine:migrations:up-to-date', - ]); - $result = $application->doRun($command, $output); + if (0 !== $result) { + $io->info('Update aborted. Migrations need to run for the system to work. Run doctrine:migrations:migrate or rerun app:update to migrate.'); - if (0 !== $result) { - $io->info('Run doctrine:migrations:migrate to migrate to latest migration.'); + return Command::FAILURE; + } - return Command::FAILURE; + $allTemplates = $this->templateService->getAllTemplates(); + $installedTemplates = array_filter($allTemplates, fn ($entry): bool => $entry->installed); + + // If no installed templates, we assume that this is a new installation and offer to install all templates. + if ($isInteractive && count($installedTemplates) === 0) { + $question = new Question("No templates are installed. Install all " .count($allTemplates) . "?", "yes"); + $question->setAutocompleterValues(["yes", "no"]); + $installAll = $io->askQuestion($question); + + if ($installAll === "yes") { + $io->info('Installing all templates...'); + $command = new ArrayInput([ + 'command' => 'app:templates:install', + '--all' => true, + ]); + $application->doRun($command, $output); } - - $io->writeln(''); - $io->writeln(''); - $io->writeln(''); - $io->title('Templates status'); - - // List status for templates. + } else { + $io->info('Updating existing template...'); $command = new ArrayInput([ - 'command' => 'app:templates:list', - '--status' => true, + 'command' => 'app:templates:update', ]); - $result = $application->doRun($command, $output); - - if (0 !== $result) { - $io->info('Run app:templates:install to install missing templates.'); - - return Command::FAILURE; - } + $application->doRun($command, $output); } return Command::SUCCESS; diff --git a/src/Service/TemplateService.php b/src/Service/TemplateService.php index c19b7162..34579069 100644 --- a/src/Service/TemplateService.php +++ b/src/Service/TemplateService.php @@ -43,6 +43,20 @@ public function installTemplate(TemplateData $templateData, bool $update = false $this->entityManager->flush(); } + public function updateTemplate(TemplateData $templateData): void + { + $template = $templateData->templateEntity; + + // Ignore templates that do not exist in the database. + if ($template === null) { + return; + } + + $template->setTitle($templateData->title); + + $this->entityManager->flush(); + } + public function getAllTemplates(): array { return array_merge($this->getCoreTemplates(), $this->getCustomTemplates()); From 81743ecd95c5048f853f9ff9b7a2ea89bfbc0bd3 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 15:02:33 +0200 Subject: [PATCH 05/10] 4565: Applied coding standards --- src/Command/StatusCommand.php | 1 - src/Command/TemplatesUpdateCommand.php | 3 --- src/Command/UpdateCommand.php | 9 ++++----- src/Service/TemplateService.php | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Command/StatusCommand.php b/src/Command/StatusCommand.php index 6b8464c4..455a19b7 100644 --- a/src/Command/StatusCommand.php +++ b/src/Command/StatusCommand.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/src/Command/TemplatesUpdateCommand.php b/src/Command/TemplatesUpdateCommand.php index d2e67776..eb520741 100644 --- a/src/Command/TemplatesUpdateCommand.php +++ b/src/Command/TemplatesUpdateCommand.php @@ -4,13 +4,10 @@ namespace App\Command; -use App\Model\TemplateData; use App\Service\TemplateService; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index 8ce0bead..b6337d0b 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -27,7 +27,6 @@ public function __construct(TemplateService $templateService, ?string $name = nu $this->templateService = $templateService; } - final protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -57,12 +56,12 @@ final protected function execute(InputInterface $input, OutputInterface $output) $installedTemplates = array_filter($allTemplates, fn ($entry): bool => $entry->installed); // If no installed templates, we assume that this is a new installation and offer to install all templates. - if ($isInteractive && count($installedTemplates) === 0) { - $question = new Question("No templates are installed. Install all " .count($allTemplates) . "?", "yes"); - $question->setAutocompleterValues(["yes", "no"]); + if ($isInteractive && 0 === count($installedTemplates)) { + $question = new Question('No templates are installed. Install all '.count($allTemplates).'?', 'yes'); + $question->setAutocompleterValues(['yes', 'no']); $installAll = $io->askQuestion($question); - if ($installAll === "yes") { + if ('yes' === $installAll) { $io->info('Installing all templates...'); $command = new ArrayInput([ 'command' => 'app:templates:install', diff --git a/src/Service/TemplateService.php b/src/Service/TemplateService.php index 34579069..d99286dd 100644 --- a/src/Service/TemplateService.php +++ b/src/Service/TemplateService.php @@ -48,7 +48,7 @@ public function updateTemplate(TemplateData $templateData): void $template = $templateData->templateEntity; // Ignore templates that do not exist in the database. - if ($template === null) { + if (null === $template) { return; } From 1b611ed7528d79bcb289c10c3abbc89691d41ac2 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:01:37 +0200 Subject: [PATCH 06/10] 4565: Fixed output from app:status command --- src/Command/StatusCommand.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Command/StatusCommand.php b/src/Command/StatusCommand.php index 455a19b7..73e82847 100644 --- a/src/Command/StatusCommand.php +++ b/src/Command/StatusCommand.php @@ -35,13 +35,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) $command = new ArrayInput([ 'command' => 'doctrine:migrations:up-to-date', ]); - $result = $application->doRun($command, $output); - - if (0 !== $result) { - $io->info('Run doctrine:migrations:migrate to migrate to latest migration.'); - - return Command::FAILURE; - } + $application->doRun($command, $output); $io->writeln(''); $io->writeln(''); @@ -53,13 +47,9 @@ final protected function execute(InputInterface $input, OutputInterface $output) 'command' => 'app:templates:list', '--status' => true, ]); - $result = $application->doRun($command, $output); + $application->doRun($command, $output); - if (0 !== $result) { - $io->info('Run app:templates:install to install missing templates.'); - - return Command::FAILURE; - } + $io->info('Run app:update to update migrations and templates.'); return Command::SUCCESS; } From 4b8d66cc7c7d5932e524fa95628e9d0c16980bb6 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:17:55 +0200 Subject: [PATCH 07/10] 4565: Added update command documentation --- README.md | 13 +++++++++++-- Taskfile.yml | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bbfd47e5..45193abc 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,12 @@ To get started with the development setup, run the following task command: ```shell task site-install + +# or if you want to load fixtures as well +task site-install-with-fixtures ``` -If you want to load fixtures, use the command (use the option `--yes` for auto-confirming). +If you want to load fixtures manually, use the command (`--yes` for auto-confirming): ```shell task fixtures:load --yes @@ -92,7 +95,7 @@ The fixtures have an admin user: with the password: "apasswo The fixtures have an editor user: with the password: "apassword". -The fixtures have the image-text template, and two screen layouts: full screen and "two boxes". +The fixtures have the image-text template, and two screen layouts: "full screen" and "two boxes". ## Production setup @@ -107,6 +110,12 @@ APP_SECRET= TODO: Add further production instructions: Build steps, release.json, etc. +Use the `app:update` command to migrate and update templates to latest version: + +``` +docker compose exec phpfpm bin/console app:update --no-interaction +``` + ## Coding standards Before a PR can be merged it has to pass the GitHub Actions checks. See `.github/workflows` for workflows that should diff --git a/Taskfile.yml b/Taskfile.yml index bdb7e896..f969f8b5 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -216,3 +216,8 @@ tasks: desc: "Generate the RTK Query api slices (in assets/shared/redux/)." cmds: - task compose -- exec node npx @rtk-query/codegen-openapi /app/assets/shared/redux/openapi-config.js + + app:update: + desc: "Migrate to latest database schema and update installed templates" + cmds: + - task compose -- exec phpfpm bin/console --no-interaction From 6d68690e48440653d5d54745de4ad368c8f77b41 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:20:26 +0200 Subject: [PATCH 08/10] 4565: Applied markdown styles --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45193abc..14719d35 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ TODO: Add further production instructions: Build steps, release.json, etc. Use the `app:update` command to migrate and update templates to latest version: -``` +```shell docker compose exec phpfpm bin/console app:update --no-interaction ``` From a48f88ef6a8436d2070c01b2ae13314c6fbd7b9b Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:59:43 +0200 Subject: [PATCH 09/10] 4565: Fixed task --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index f969f8b5..1289339a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -220,4 +220,4 @@ tasks: app:update: desc: "Migrate to latest database schema and update installed templates" cmds: - - task compose -- exec phpfpm bin/console --no-interaction + - task compose -- exec phpfpm bin/console app:update --no-interaction From f225a7dab6284e4ca0e4d0a0698fdb3dcab010ba Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Fri, 5 Sep 2025 09:59:59 +0200 Subject: [PATCH 10/10] 4565: Changed Question to ConfirmationQuestion --- src/Command/UpdateCommand.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Command/UpdateCommand.php b/src/Command/UpdateCommand.php index b6337d0b..ad52ca0d 100644 --- a/src/Command/UpdateCommand.php +++ b/src/Command/UpdateCommand.php @@ -10,7 +10,7 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand( @@ -57,8 +57,7 @@ final protected function execute(InputInterface $input, OutputInterface $output) // If no installed templates, we assume that this is a new installation and offer to install all templates. if ($isInteractive && 0 === count($installedTemplates)) { - $question = new Question('No templates are installed. Install all '.count($allTemplates).'?', 'yes'); - $question->setAutocompleterValues(['yes', 'no']); + $question = new ConfirmationQuestion('No templates are installed. Install all '.count($allTemplates).'?'); $installAll = $io->askQuestion($question); if ('yes' === $installAll) {