|
| 1 | +..index:: |
| 2 | + single: Doctrine; ORM console commands |
| 3 | + single: CLI; Doctrine ORM |
| 4 | + |
| 5 | +Console Commands |
| 6 | +---------------- |
| 7 | + |
| 8 | +The Doctrine2 ORM integration offers several console commands under the |
| 9 | +``doctrine`` namespace. To view the command list you can use the ``list`` |
| 10 | +command: |
| 11 | + |
| 12 | +..code-block::bash |
| 13 | +
|
| 14 | + $ php app/console list doctrine |
| 15 | +
|
| 16 | +A list of available commands will print out. You can find out more information |
| 17 | +about any of these commands (or any Symfony command) by running the ``help`` |
| 18 | +command. For example, to get details about the ``doctrine:database:create`` |
| 19 | +task, run: |
| 20 | + |
| 21 | +..code-block::bash |
| 22 | +
|
| 23 | + $ php app/consolehelp doctrine:database:create |
| 24 | +
|
| 25 | +Some notable or interesting tasks include: |
| 26 | + |
| 27 | +* ``doctrine:ensure-production-settings`` - checks to see if the current |
| 28 | + environment is configured efficiently for production. This should always |
| 29 | + be run in the ``prod`` environment: |
| 30 | + |
| 31 | + ..code-block::bash |
| 32 | +
|
| 33 | + $ php app/console doctrine:ensure-production-settings --env=prod |
| 34 | +
|
| 35 | +* ``doctrine:mapping:import`` - allows Doctrine to introspect an existing |
| 36 | + database and create mapping information. For more information, see |
| 37 | +:doc:`/cookbook/doctrine/reverse_engineering`. |
| 38 | + |
| 39 | +* ``doctrine:mapping:info`` - tells you all of the entities that Doctrine |
| 40 | + is aware of and whether or not there are any basic errors with the mapping. |
| 41 | + |
| 42 | +* ``doctrine:query:dql`` and ``doctrine:query:sql`` - allow you to execute |
| 43 | + DQL or SQL queries directly from the command line. |