@@ -56,11 +56,11 @@ folder.
56
56
The first step towards building entity classes from an existing database
57
57
is to ask Doctrine to introspect the database and generate the corresponding
58
58
metadata files. Metadata files describe the entity class to generate based on
59
- tables fields.
59
+ table fields.
60
60
61
61
.. code-block :: bash
62
62
63
- $ php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine --from-database -- force
63
+ $ php app/console doctrine:mapping:import -- force AcmeBlogBundle xml
64
64
65
65
This command line tool asks Doctrine to introspect the database and generate
66
66
the XML metadata files under the ``src/Acme/BlogBundle/Resources/config/doctrine ``
@@ -69,16 +69,16 @@ folder of your bundle. This generates two files: ``BlogPost.orm.xml`` and
69
69
70
70
.. tip ::
71
71
72
- It's also possible to generate metadata class in YAML format by changing the
73
- first argument to ``yml ``.
72
+ It's also possible to generate the metadata files in YAML format by changing
73
+ the last argument to ``yml ``.
74
74
75
75
The generated ``BlogPost.orm.xml `` metadata file looks as follows:
76
76
77
77
.. code-block :: xml
78
78
79
79
<?xml version =" 1.0" encoding =" utf-8" ?>
80
80
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
81
- <entity name =" BlogPost" table =" blog_post" >
81
+ <entity name =" Acme\BlogBundle\Entity\ BlogPost" table =" blog_post" >
82
82
<id name =" id" type =" bigint" column =" id" >
83
83
<generator strategy =" IDENTITY" />
84
84
</id >
@@ -88,13 +88,6 @@ The generated ``BlogPost.orm.xml`` metadata file looks as follows:
88
88
</entity >
89
89
</doctrine-mapping >
90
90
91
- Update the namespace in the ``name `` attribute of the ``entity `` element like
92
- this:
93
-
94
- .. code-block :: xml
95
-
96
- <entity name =" Acme\BlogBundle\Entity\BlogPost" table =" blog_post" >
97
-
98
91
Once the metadata files are generated, you can ask Doctrine to build related
99
92
entity classes by executing the following two commands.
100
93
@@ -103,14 +96,14 @@ entity classes by executing the following two commands.
103
96
$ php app/console doctrine:mapping:convert annotation ./src
104
97
$ php app/console doctrine:generate:entities AcmeBlogBundle
105
98
106
- The first command generates entity classes with an annotations mapping . But
99
+ The first command generates entity classes with annotation mappings . But
107
100
if you want to use yml or xml mapping instead of annotations, you should
108
101
execute the second command only.
109
102
110
103
.. tip ::
111
104
112
<
5CE8
td data-grid-cell-id="diff-497d6d3f421dc8f4158224163d2d8f0a2364aa81e76b3d56255294a0ca996786-112-104-1" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-deletionNum-bgColor, var(--diffBlob-deletion-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">
- If you want to use annotations, you can safely delete the XML files after
113
- running these two commands.
105
+ If you want to use annotations, you can safely delete the XML (or YAML) files
106
+ after running these two commands.
114
107
115
108
For example, the newly created ``BlogComment `` entity class looks as follow::
116
109
0 commit comments