Skip to content

Commit 2c68f04

Browse files
committed
Moved commands to cookbook
It's not really basic information. All important commands are already discussed in the rest of the chapter. The rest are just usefull commands, which is a perfect topic for a cookbook.
1 parent 88aa347 commit 2c68f04

File tree

4 files changed

+63
-61
lines changed

4 files changed

+63
-61
lines changed

book/doctrine.rst

+1-61
Original file line numberDiff line numberDiff line change
@@ -1354,67 +1354,6 @@ maps a PHP data type to a specific column type in whatever database you're
13541354
using. To see a list of all available types and more information, see
13551355
Doctrine's `Mapping Types documentation`_.
13561356

1357-
.. index::
1358-
single: Doctrine; ORM console commands
1359-
single: CLI; Doctrine ORM
1360-
1361-
Console Commands
1362-
----------------
1363-
1364-
The Doctrine2 ORM integration offers several console commands under the
1365-
``doctrine`` namespace. To view the command list you can run the console
1366-
without any arguments:
1367-
1368-
.. code-block:: bash
1369-
1370-
$ php app/console
1371-
1372-
A list of available commands will print out, many of which start with the
1373-
``doctrine:`` prefix. You can find out more information about any of these
1374-
commands (or any Symfony command) by running the ``help`` command. For example,
1375-
to get details about the ``doctrine:database:create`` task, run:
1376-
1377-
.. code-block:: bash
1378-
1379-
$ php app/console help doctrine:database:create
1380-
1381-
Some notable or interesting tasks include:
1382-
1383-
* ``doctrine:ensure-production-settings`` - checks to see if the current
1384-
environment is configured efficiently for production. This should always
1385-
be run in the ``prod`` environment:
1386-
1387-
.. code-block:: bash
1388-
1389-
$ php app/console doctrine:ensure-production-settings --env=prod
1390-
1391-
* ``doctrine:mapping:import`` - allows Doctrine to introspect an existing
1392-
database and create mapping information. For more information, see
1393-
:doc:`/cookbook/doctrine/reverse_engineering`.
1394-
1395-
* ``doctrine:mapping:info`` - tells you all of the entities that Doctrine
1396-
is aware of and whether or not there are any basic errors with the mapping.
1397-
1398-
* ``doctrine:query:dql`` and ``doctrine:query:sql`` - allow you to execute
1399-
DQL or SQL queries directly from the command line.
1400-
1401-
.. note::
1402-
1403-
To be able to load data fixtures to your database, you will need to have
1404-
the DoctrineFixturesBundle bundle installed. To learn how to do it,
1405-
read the ":doc:`/bundles/DoctrineFixturesBundle/index`" entry of the
1406-
documentation.
1407-
1408-
.. tip::
1409-
1410-
This page shows working with Doctrine within a controller. You may also
1411-
want to work with Doctrine elsewhere in your application. The
1412-
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine`
1413-
method of the controller returns the ``doctrine`` service, you can work with
1414-
this in the same way elsewhere by injecting this into your own
1415-
services. See :doc:`/book/service_container` for more on creating
1416-
your own services.
1417-
14181357
Summary
14191358
-------
14201359

@@ -1434,6 +1373,7 @@ For more information about Doctrine, see the *Doctrine* section of the
14341373

14351374
* :doc:`/bundles/DoctrineFixturesBundle/index`
14361375
* :doc:`/cookbook/doctrine/common_extensions`
1376+
* :doc:`/cookbook/doctrine/console`
14371377

14381378
.. _`Doctrine`: http://www.doctrine-project.org/
14391379
.. _`MongoDB`: http://www.mongodb.org/

cookbook/doctrine/console.rst

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 run the console
10+
without any arguments:
11+
12+
.. code-block:: bash
13+
14+
$ php app/console
15+
16+
A list of available commands will print out, many of which start with the
17+
``doctrine:`` prefix. You can find out more information about any of these
18+
commands (or any Symfony command) by running the ``help`` command. For example,
19+
to get details about the ``doctrine:database:create`` task, run:
20+
21+
.. code-block:: bash
22+
23+
$ php app/console help 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.
44+
45+
.. note::
46+
47+
To be able to load data fixtures to your database, you will need to have
48+
the DoctrineFixturesBundle bundle installed. To learn how to do it,
49+
read the ":doc:`/bundles/DoctrineFixturesBundle/index`" entry of the
50+
documentation.
51+
52+
.. tip::
53+
54+
This page shows working with Doctrine within a controller. You may also
55+
want to work with Doctrine elsewhere in your application. The
56+
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine`
57+
method of the controller returns the ``doctrine`` service, you can work with
58+
this in the same way elsewhere by injecting this into your own
59+
services. See :doc:`/book/service_container` for more on creating
60+
your own services.

cookbook/doctrine/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Doctrine
1414
resolve_target_entity
1515
mapping_model_classes
1616
registration_form
17+
console

cookbook/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
* :doc:`/cookbook/doctrine/resolve_target_entity`
6363
* :doc:`/cookbook/doctrine/mapping_model_classes`
6464
* :doc:`/cookbook/doctrine/registration_form`
65+
* :doc:`/cookbook/doctrine/console`
6566

6667
* :doc:`/cookbook/email/index`
6768

0 commit comments

Comments
 (0)