Skip to content

Commit

Permalink
Merge pull request #1638 from ConductionNL/feature/GW-1624/initialize…
Browse files Browse the repository at this point in the history
…-command

Improve Initialize command
  • Loading branch information
WilcoLouwerse authored Apr 15, 2024
2 parents 7620c9e + 57c88c3 commit 9dfced1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/docker/php/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then

if [ "$APP_INIT" != 'false' ]; then
echo "Initializing the gateway"
bin/console commongateway:initialize
bin/console commongateway:initialize --cache-warmup
fi

fi
Expand Down
27 changes: 20 additions & 7 deletions api/src/Command/InitializationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ protected function configure(): void
$this
->addOption('bundle', 'b', InputOption::VALUE_OPTIONAL, 'The bundle that you want to install (install only that bundle)')
->addOption('data', 'd', InputOption::VALUE_OPTIONAL, 'Load (example) data set(s) from the bundle', false)
->addOption('skip-schema', 'sa', InputOption::VALUE_OPTIONAL, 'Don\'t update schema\'s during upgrade', false)
->addOption('skip-script', 'sp', InputOption::VALUE_OPTIONAL, 'Don\'t execute installation scripts during upgrade', false)
->addOption('unsafe', 'u', InputOption::VALUE_OPTIONAL, 'Delete data that is not present in the test data', false)
->addOption('skip-schema', 's', InputOption::VALUE_OPTIONAL, 'Don\'t update schema\'s during upgrade', false)
->addOption('skip-script', 'x', InputOption::VALUE_OPTIONAL, 'Don\'t execute installation scripts during upgrade', false)
->addOption('cache-warmup', 'c', InputOption::VALUE_OPTIONAL, 'Include running a cache:warmup at the end', false)
//todo?
// ->addOption('unsafe', 'u', InputOption::VALUE_OPTIONAL, 'Delete data that is not present in the test data', false)
// the short description shown while running "php bin/console list"
->setDescription('Facilitates the initialization of the gateway and checks configuration')

Expand All @@ -85,10 +87,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$config = [];
$config['bundle'] = $input->getOption('bundle');
$config['data'] = $input->getOption('data');
$config['skip-schema'] = $input->getOption('skip-schema');
$config['skip-script'] = $input->getOption('skip-script');
$config['unsafe'] = $input->getOption('unsafe');
if ($input->getOption('data') !== false) {
$config['data'] = true;
}
if ($input->getOption('skip-schema') !== false) {
$config['skip-schema'] = true;
}
if ($input->getOption('skip-script') !== false) {
$config['skip-script'] = true;
}
if ($input->getOption('cache-warmup') !== false) {
$config['cache-warmup'] = true;
}
// if ($input->getOption('unsafe') !== false) {
// $config['unsafe'] = true;
// }

// Throw the event
$io->info('Throwing commongateway.pre.initialization event');
Expand Down

0 comments on commit 9dfced1

Please sign in to comment.