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

Already on GitHub? Sign in to your account

Add a simple Confirmation if --append option isn't set #58

Merged
merged 4 commits into from Aug 20, 2012

Conversation

Projects
None yet
3 participants
Contributor

sylwit commented Aug 18, 2012

Add a simple Confirmation if --append option isn't set

Prevent purging database if --append option isn't set
Add a simple Confirmation if --append option isn't set
Member

stof commented Aug 19, 2012

This breaks things when the input is not interactive (as it will wait for the confirmation forever). You need to add this check only conditionally.

Contributor

sylwit commented Aug 20, 2012

what do you think about adding a --forced option like for the doctrine:schema:update.

I guess it could prevent mistakes

Member

stof commented Aug 20, 2012

you don't need a force. You simply need to check if the input is interactive before asking confirmation (the DoctrineMigrationsBundle does it)

Contributor

sylwit commented Aug 20, 2012

Ok done, I didn't know this interactive method. Thanks for the tip

@stof stof commented on an outdated diff Aug 20, 2012

Command/LoadDataFixturesDoctrineCommand.php
@@ -68,6 +68,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getManager($input->getOption('em'));
+ if ($input->isInteractive()) {
+ if (!$input->getOption('append')){
@stof

stof Aug 20, 2012

Member

you should use && instead of nesting 2 if

Contributor

sylwit commented Aug 20, 2012

done

stof added a commit that referenced this pull request Aug 20, 2012

Merge pull request #58 from openify/master
Add a simple Confirmation if --append option isn't set

@stof stof merged commit 186d605 into doctrine:master Aug 20, 2012

How can I suppress this dialog? travis-ci hangs for 15minutes then times out. I could not find, where to setInteractive(false) as I just run "app/console doctrine:fixtures:load"

IMHO there should be an option "--non-interactive" or stuff, right?

Cheers
Uwe

--append works for me for now...

thanks anyway
Uwe

Member

stof replied Aug 22, 2012

@uwepriessixt This dialog is added only when the console is interactive. So simply add --no-interaction (or the -n shortcut) which is available for all commands as it is a generic option provided by the console itself.

Btw, displaying the help of the command (app/console help doctrine:fixtures:load or app/console doctrine:fixtures:load --help) would have answered your question

Hi Christophe,

thank you for your quick answer, that did it. To be honest, I didn't know this general option blush, tho I did know the --help option, but this does not reveal the option "--no-interaction"

Cheers
Uwe

Member

stof replied Aug 22, 2012

@uwepriessixt hmm, indeed. Global options are displayed only when showing the help of the application itself app/console help, not when showing the help of a particular command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment