From d3602a90123a214087f899f57a03ac61a0349972 Mon Sep 17 00:00:00 2001 From: "Marc J. Schmidt" Date: Wed, 19 Nov 2014 18:47:02 +0100 Subject: [PATCH] Added --overwrite optin to sql:build command to allow overwriting the sql.map file without the need to remove it manually. Made also --sql-dir configurable and changed its default value to %app_dir%/propel/sql like in propelBundle v1. --- Command/SqlBuildCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Command/SqlBuildCommand.php b/Command/SqlBuildCommand.php index e4a35ee..008d614 100644 --- a/Command/SqlBuildCommand.php +++ b/Command/SqlBuildCommand.php @@ -28,7 +28,8 @@ class SqlBuildCommand extends WrappedCommand $this ->setName('propel:sql:build') ->setDescription('Build SQL files') - + ->addOption('sql-dir', null, InputOption::VALUE_REQUIRED, 'The SQL files directory') + ->addOption('overwrite', null, InputOption::VALUE_NONE, '') ->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Connection to use. Example: default, bookstore') ; } @@ -46,9 +47,12 @@ class SqlBuildCommand extends WrappedCommand */ protected function getSubCommandArguments(InputInterface $input) { + $defaultSqlDir = sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getRootDir()); + return array( - '--output-dir' => $this->getCacheDir(), '--connection' => $this->getConnections($input->getOption('connection')), + '--sql-dir' => $input->getOption('sql-dir') ?: $defaultSqlDir, + '--overwrite' => $input->getOption('overwrite') ); } }