setName('doctrine:query:dql') ->setHelp(<<%command.name% command executes the given DQL query and outputs the results: php %command.full_name% "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: php %command.full_name% "SELECT u FROM UserBundle:User u" --hydrate=array Additionally you can specify the first result and maximum amount of results to show: php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30 EOT ); if ($this->getDefinition()->hasOption('em')) { return; } $this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command'); } }