RunDqlDoctrineCommand.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Symfony\Framework\DoctrineBundle\Command;
  3. use Symfony\Components\Console\Input\InputArgument;
  4. use Symfony\Components\Console\Input\InputOption;
  5. use Symfony\Components\Console\Input\InputInterface;
  6. use Symfony\Components\Console\Output\OutputInterface;
  7. use Symfony\Components\Console\Output\Output;
  8. use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
  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. * Execute a Doctrine DQL query and output the results.
  19. *
  20. * @package Symfony
  21. * @subpackage Framework_DoctrineBundle
  22. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  23. * @author Jonathan H. Wage <jonwage@gmail.com>
  24. */
  25. class RunDqlDoctrineCommand extends RunDqlCommand
  26. {
  27. /**
  28. * @see Command
  29. */
  30. protected function configure()
  31. {
  32. parent::configure();
  33. $this->setName('doctrine:run-dql');
  34. $this->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to execute the DQL query on.');
  35. }
  36. /**
  37. * @see Command
  38. */
  39. protected function execute(InputInterface $input, OutputInterface $output)
  40. {
  41. DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
  42. return parent::execute($input, $output);
  43. }
  44. }