php bin/console doctrine:query:dql

Executes arbitrary DQL directly from the command line

Usage

doctrine:query:dql [--em EM] [--hydrate HYDRATE] [--first-result FIRST-RESULT] [--max-result MAX-RESULT] [--depth DEPTH] [--show-sql] [--] <dql>

Arguments

dql   The DQL to execute. 

Options

      --em             Name of the entity manager to operate on 
      --hydrate        Hydration mode of result set. Should be either: object, array, scalar or single-scalar. 
      --first-result   The first result in the result set. 
      --max-result     The maximum number of results in the result set. 
      --depth          Dumping depth of Entity graph. 
      --show-sql       Dump generated SQL instead of executing query 

Help

The doctrine:query:dql command executes the given DQL query and
outputs the results:

php bin/console 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:

php bin/console doctrine:query:dql "SELECT u FROM UserBundle:User u" --hydrate=array

Additionally you can specify the first result and maximum amount of results to
show:

php bin/console doctrine:query:dql "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30