@@ -115,12 +115,14 @@ and place your `User` class in it.
115
115
> to call parent::__ construct(), as the base User class depends on
116
116
> this to initialize some fields.
117
117
118
- ** a) Doctrine ORM User class**
118
+ #### a) Doctrine ORM User class
119
119
120
120
If you're persisting your users via the Doctrine ORM, then your ` User ` class
121
121
should live in the ` Entity ` namespace of your bundle and look like this to
122
122
start:
123
123
124
+ ##### Annotations
125
+
124
126
``` php
125
127
<?php
126
128
// src/Acme/UserBundle/Entity/User.php
@@ -155,7 +157,48 @@ class User extends BaseUser
155
157
156
158
> ` User ` is a reserved keyword in SQL so you cannot use it as table name.
157
159
158
- ** b) MongoDB User class**
160
+ ##### yaml
161
+
162
+ If you use yml to configure Doctrine you must add two files. The Entity and the orm.yml:
163
+
164
+ ``` php
165
+ <?php
166
+ // src/Acme/UserBundle/Entity/User.php
167
+
168
+ namespace Acme\UserBundle\Entity;
169
+
170
+ use Doctrine\ORM\Mapping as ORM;
171
+ use FOS\UserBundle\Entity\User as BaseUser;
172
+
173
+ /**
174
+ * User
175
+ */
176
+ class User extends BaseUser {
177
+ /**
178
+ * @var integer
179
+ */
180
+ protected $id;
181
+
182
+ public function __construct()
183
+ {
184
+ parent::__construct();
185
+ // your own logic
186
+ }
187
+ }
188
+ ```
189
+ ``` yaml
190
+ # src/Acme/UserBundle/Resources/config/doctrine/User.orm.yml
191
+ Acme\UserBundle\Entity\User :
192
+ type : entity
193
+ table : fos_user
194
+ id :
195
+ id :
196
+ type : integer
197
+ strategy : { generator: "AUTO" }
198
+ lifecycleCallbacks : { }
199
+ ` ` `
200
+
201
+ #### b) MongoDB User class
159
202
160
203
If you're persisting your users via the Doctrine MongoDB ODM, then your ` User`
161
204
class should live in the `Document` namespace of your bundle and look like
@@ -188,7 +231,7 @@ class User extends BaseUser
188
231
}
189
232
` ` `
190
233
191
- ** c) CouchDB User class**
234
+ # ### c) CouchDB User class
192
235
193
236
If you're persisting your users via the Doctrine CouchDB ODM, then your `User`
194
237
class should live in the `Document` namespace of your bundle and look like
0 commit comments