2013-07-22 35 views
0

我剛剛創建了一個自定義類,它將執行更多命令。該命令將在未來由機器人發起。Symfony自動響應問題

但是當我做了

$command_fixtures_load = $this->getApplication()->find('doctrine:fixtures:load'); 
     $arguments_fixtures_load = array(
      'command' => 'doctrine:fixtures:load', 
      '--fixtures' => "src/XXX/XXXBundle/Tests/DataFixtures" 
     ); 
     $input_fixtures_load = new ArrayInput($arguments_fixtures_load); 
     $command_fixtures_load->run($input_fixtures_load, $output); 

我有這樣的:

Careful, database will be purged. Do you want to continue Y/N ? 

所以腳本等待一個答案,否則我不會給答案,但它使負載燈具全自動。

怎麼樣?

+0

從這裏看到接受的答案和註釋:http://stackoverflow.com/questions/10497567/how-can-i-run-symfony-2-run-命令從控制器 – cheesemacfly

回答

0

運行

php app/console doctrine:fixtures:load --no-interaction 

將清除您的數據庫,但不問這個問題。

要查看更多選項運行

php app/console doctrine:fixtures:load --help