vendor/doctrine/doctrine-bundle/Command/Proxy/RunDqlDoctrineCommand.php line 13

Open in your IDE?
  1. <?php
  2. namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
  3. use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. /**
  8.  * Execute a Doctrine DQL query and output the results.
  9.  */
  10. class RunDqlDoctrineCommand extends RunDqlCommand
  11. {
  12.     /**
  13.      * {@inheritDoc}
  14.      */
  15.     protected function configure()
  16.     {
  17.         parent::configure();
  18.         $this
  19.             ->setName('doctrine:query:dql')
  20.             ->setHelp(<<<EOT
  21. The <info>%command.name%</info> command executes the given DQL query and
  22. outputs the results:
  23. <info>php %command.full_name% "SELECT u FROM UserBundle:User u"</info>
  24. You can also optional specify some additional options like what type of
  25. hydration to use when executing the query:
  26. <info>php %command.full_name% "SELECT u FROM UserBundle:User u" --hydrate=array</info>
  27. Additionally you can specify the first result and maximum amount of results to
  28. show:
  29. <info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
  30. EOT
  31.         );
  32.         if ($this->getDefinition()->hasOption('em')) {
  33.             return;
  34.         }
  35.         $this->addOption('em'nullInputOption::VALUE_OPTIONAL'The entity manager to use for this command');
  36.     }
  37.     /**
  38.      * {@inheritDoc}
  39.      */
  40.     protected function execute(InputInterface $inputOutputInterface $output)
  41.     {
  42.         DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
  43.         return parent::execute($input$output);
  44.     }
  45. }