EnsureProductionSettingsDoctrineCommand.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Symfony\Bundle\DoctrineBundle\Command;
  3. use Symfony\Component\Console\Input\InputArgument;
  4. use Symfony\Component\Console\Input\InputOption;
  5. use Symfony\Component\Console\Input\InputInterface;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use Symfony\Component\Console\Output\Output;
  8. use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
  9. /*
  10. * This file is part of the Symfony framework.
  11. *
  12. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  13. *
  14. * This source file is subject to the MIT license that is bundled
  15. * with this source code in the file LICENSE.
  16. */
  17. /**
  18. * Ensure the Doctrine ORM is configured properly for a production environment.
  19. *
  20. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  21. * @author Jonathan H. Wage <jonwage@gmail.com>
  22. */
  23. class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand
  24. {
  25. protected function configure()
  26. {
  27. parent::configure();
  28. $this
  29. ->setName('doctrine:ensure-production-settings')
  30. ->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
  31. ->setHelp(<<<EOT
  32. The <info>doctrine:cache:clear-metadata</info> command clears all metadata cache for the default entity manager:
  33. <info>./symfony doctrine:cache:clear-metadata</info>
  34. You can also optionally specify the <comment>--em</comment> option to specify which entity manager to clear the cache for:
  35. <info>./symfony doctrine:cache:clear-metadata --em=default</info>
  36. EOT
  37. );
  38. }
  39. protected function execute(InputInterface $input, OutputInterface $output)
  40. {
  41. DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
  42. parent::execute($input, $output);
  43. }
  44. }