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.
This commit is contained in:
Marc J. Schmidt 2014-11-19 18:47:02 +01:00
parent 5b15a2ea62
commit d3602a9012

View file

@ -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')
);
}
}