Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 2.3 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

Console Commands

2.3 version

Console Commands

The Doctrine2 ORM integration offers several console commands under the doctrine namespace. To view the command list you can use the list command:

$ php app/console list doctrine

A list of available commands will print out. You can find out more information about any of these commands (or any Symfony command) by running the help command. For example, to get details about the doctrine:database:create task, run:

$ php app/console help doctrine:database:create

Some notable or interesting tasks include:

  • doctrine:ensure-production-settings - checks to see if the current environment is configured efficiently for production. This should always be run in the prod environment:

    $ php app/console doctrine:ensure-production-settings --env=prod
  • doctrine:mapping:import - allows Doctrine to introspect an existing database and create mapping information. For more information, see How to Generate Entities from an Existing Database.

  • doctrine:mapping:info - tells you all of the entities that Doctrine is aware of and whether or not there are any basic errors with the mapping.

  • doctrine:query:dql and doctrine:query:sql - allow you to execute DQL or SQL queries directly from the command line.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.