Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Initialize command #1638

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading