@@ -76,21 +76,21 @@ The generated ``BlogPost.dcm.xml`` metadata file looks as follows:
7676.. code-block :: xml
7777
7878 <?xml version =" 1.0" encoding =" utf-8" ?>
79- <doctrine-mapping >
80- <entity name =" BlogPost" table =" blog_post" >
81- <change-tracking-policy >DEFERRED_IMPLICIT</change-tracking-policy >
82- <id name =" id" type =" bigint" column =" id" >
83- <generator strategy =" IDENTITY" />
84- </id >
85- <field name =" title" type =" string" column =" title" length =" 100" />
86- <field name =" content" type =" text" column =" content" />
87- <field name =" isPublished" type =" boolean" column =" is_published" />
88- <field name =" createdAt" type =" datetime" column =" created_at" />
89- <field name =" updatedAt" type =" datetime" column =" updated_at" />
90- <field name =" slug" type =" string" column =" slug" length =" 255" />
91- <lifecycle-callbacks />
92- </entity >
93- </doctrine-mapping >
79+ <doctrine-mapping >
80+ <entity name =" BlogPost" table =" blog_post" >
81+ <change-tracking-policy >DEFERRED_IMPLICIT</change-tracking-policy >
82+ <id name =" id" type =" bigint" column =" id" >
83+ <generator strategy =" IDENTITY" />
84+ </id >
85+ <field name =" title" type =" string" column =" title" length =" 100" />
86+ <field name =" content" type =" text" column =" content" />
87+ <field name =" isPublished" type =" boolean" column =" is_published" />
88+ <field name =" createdAt" type =" datetime" column =" created_at" />
89+ <field name =" updatedAt" type =" datetime" column =" updated_at" />
90+ <field name =" slug" type =" string" column =" slug" length =" 255" />
91+ <lifecycle-callbacks />
92+ </entity >
93+ </doctrine-mapping >
9494
9595 Once the metadata files are generated, you can ask Doctrine to import the
9696schema and build related entity classes by executing the following two commands.
@@ -108,57 +108,57 @@ The newly created ``BlogComment`` entity class looks as follow:
108108
109109 <?php
110110
111- // src/Acme/BlogBundle/Entity/BlogComment.php
112- namespace Acme\BlogBundle\Entity;
113-
114- /**
115- * Acme\BlogBundle\Entity\BlogComment
116- *
117- * @orm:Table(name="blog_comment")
118- * @orm:Entity
119- */
120- class BlogComment
121- {
122- /**
123- * @var bigint $id
124- *
125- * @orm:Column(name="id", type=" bigint", nullable=false)
126- * @orm:Id
127- * @orm:GeneratedValue(strategy="IDENTITY" )
128- */
129- private $id;
130-
131- /**
132- * @var string $author
133- *
134- * @orm:Column(name="author", type=" string", length=100, nullable=false)
135- */
136- private $ author;
137-
138- /**
139- * @var text $content
140- *
141- * @orm:Column(name="content", type=" text", nullable=false)
142- */
143- private $ content;
144-
145- /**
146- * @var datetime $createdAt
147- *
148- * @orm:Column(name="created_at", type=" datetime", nullable=false)
149- */
150- private $createdAt;
151-
152- /**
153- * @var BlogPost
154- *
155- * @orm:ManyToOne(targetEntity=" BlogPost")
156- * @orm:JoinColumns({
157- * @orm:JoinColumn(name="post_id", referencedColumnName="id ")
158- * } )
159- */
160- private $post;
161- }
111+ // src/Acme/BlogBundle/Entity/BlogComment.php
112+ namespace Acme\BlogBundle\Entity;
113+
114+ use Doctrine\ORM\Mapping as ORM;
115+
116+ /* *
117+ * Acme\BlogBundle\Entity\BlogComment
118+ *
119+ * @ORM\Table(name="blog_comment")
120+ * @ORM\Entity
121+ */
122+ class BlogComment
123+ {
124+ /* *
125+ * @var bigint $id
126+ *
127+ * @ORM\Column(name="id", type="bigint", nullable=false )
128+ * @ORM\Id
129+ * @ORM\GeneratedValue(strategy="IDENTITY")
130+ */
131+ private $id;
132+
133+ /* *
134+ * @var string $author
135+ *
136+ * @ORM\Column(name=" author", type="string", length=100, nullable=false)
137+ */
138+ private $author;
139+
140+ /* *
141+ * @var text $content
142+ *
143+ * @ORM\Column(name=" content", type="text", nullable=false)
144+ */
145+ private $content;
146+
147+ /* *
148+ * @var datetime $createdAt
149+ *
150+ * @ORM\Column(name="created_at", type="datetime", nullable=false)
151+ */
152+ private $createdAt;
153+
154+ /* *
155+ * @var BlogPost
156+ *
157+ * @ORM\ManyToOne(targetEntity="BlogPost ")
158+ * @ORM\JoinColumn(name="post_id", referencedColumnName="id" )
159+ */
160+ private $post;
161+ }
162162
163163 As you can see, Doctrine converts all table fields to pure private and annotated
164164class properties. The most impressive thing is that it also discovered the
0 commit comments