1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Fixing ensure-production-settings task to not throw an exception and instead use the Output object to output an error

This commit is contained in:
Jonathan H. Wage 2010-04-13 14:12:13 -04:00
parent 0f4ba3b875
commit 10aaf93c44

View File

@ -65,12 +65,21 @@ EOT
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{ {
$em = $this->getHelper('em')->getEntityManager(); $em = $this->getHelper('em')->getEntityManager();
$em->getConfiguration()->ensureProductionSettings();
if ($input->getOption('complete') !== null) { $error = false;
$em->getConnection()->connect(); try {
$em->getConfiguration()->ensureProductionSettings();
if ($input->getOption('complete') !== null) {
$em->getConnection()->connect();
}
} catch (\Exception $e) {
$error = true;
$output->writeln('<error>' . $e->getMessage() . '</error>');
} }
$output->write('Environment is correctly configured for production.'); if ($error === false) {
$output->write('<info>Environment is correctly configured for production.</info>' . PHP_EOL);
}
} }
} }