. */ namespace Doctrine\ORM\Tools\Console\Command; use Symfony\Component\Console\Input\InputArgument, Symfony\Component\Console\Input\InputOption, Symfony\Component\Console; /** * Command to ensure that Doctrine is properly configured for a production environment. * * * @link www.doctrine-project.org * @since 2.0 * @version $Revision$ * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel */ class EnsureProductionSettingsCommand extends Console\Command\Command { /** * @see Console\Command\Command */ protected function configure() { $this ->setName('orm:ensure-production-settings') ->setDescription('Verify that Doctrine is properly configured for a production environment.') ->setDefinition(array( new InputOption( 'complete', null, InputOption::VALUE_NONE, 'Flag to also inspect database connection existance.' ) )) ->setHelp(<<getHelper('em')->getEntityManager(); $error = false; try { $em->getConfiguration()->ensureProductionSettings(); if ($input->getOption('complete') !== null) { $em->getConnection()->connect(); } } catch (\Exception $e) { $error = true; $output->writeln('' . $e->getMessage() . ''); } if ($error === false) { $output->write('Environment is correctly configured for production.' . PHP_EOL); } } }