* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ /** * Execute a Doctrine DQL query and output the results. * * @package Symfony * @subpackage Framework_DoctrineBundle * @author Fabien Potencier * @author Jonathan H. Wage */ class RunDqlDoctrineCommand extends RunDqlCommand { protected function configure() { parent::configure(); $this ->setName('doctrine:query:dql') ->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.') ->setHelp(<<doctrine:query:dql command executes the given DQL query and outputs the results: ./symfony doctrine:query:dql "SELECT u FROM UserBundle:User u" You can also optional specify some additional options like what type of hydration to use when executing the query: ./symfony doctrine:query:dql "SELECT u FROM UserBundle:User u" --hydrate=array Additionaly you can specify the first result and maximum amount of results to show: ./symfony doctrine:query:dql "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30 EOT ); } protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em')); return parent::execute($input, $output); } }