*/ class SqlInsertCommand extends WrappedCommand { /** * {@inheritdoc} */ protected function configure() { $this ->setName('propel:sql:insert') ->setDescription('Insert SQL statements') ->addOption('force', null, InputOption::VALUE_NONE, 'Set this parameter to execute this action.') ->addOption('sql-dir', null, InputOption::VALUE_REQUIRED, 'The SQL files directory') ->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Connection to use. Example: default, bookstore') ; } /** * {@inheritdoc} */ protected function createSubCommandInstance() { return new \Propel\Generator\Command\SqlInsertCommand(); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('force')) { parent::execute($input, $output); } else { $output->writeln('You have to use --force to execute all SQL statements.'); return 1; } } /** * {@inheritdoc} */ protected function getSubCommandArguments(InputInterface $input) { $defaultSqlDir = sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getRootDir()); return array( '--connection' => $this->getConnections($input->getOption('connection')), '--sql-dir' => $input->getOption('sql-dir') ?: $defaultSqlDir, ); } }