php bin/console doctrine:query:dql
Executes arbitrary DQL directly from the command line.
Usage
doctrine:query:dql [--hydrate HYDRATE] [--first-result FIRST-RESULT] [--max-result MAX-RESULT] [--depth DEPTH] [--show-sql] [--em [EM]] [--] <dql>
Arguments
dql The DQL to execute.
Options
--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
--em The entity manager to use for this command
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