@@ -960,7 +960,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
960
960
<entity name =" Acme\StoreBundle\Entity\Category" >
961
961
<!-- ... -->
962
962
<one-to-many field =" products"
963
- target-entity =" product "
963
+ target-entity =" Product "
964
964
mapped-by =" category"
965
965
/>
966
966
@@ -988,7 +988,7 @@ makes sense in the application for each ``Category`` to hold an array of
988
988
.. tip ::
989
989
990
990
The targetEntity value in the decorator used above can reference any entity
991
- with a valid namespace, not just entities defined in the same class . To
991
+ with a valid namespace, not just entities defined in the same namespace . To
992
992
relate to an entity defined in a different class or bundle, enter a full
993
993
namespace as the targetEntity.
994
994
@@ -1038,7 +1038,8 @@ object, you'll want to add a ``$category`` property to the ``Product`` class:
1038
1038
<entity name =" Acme\StoreBundle\Entity\Product" >
1039
1039
<!-- ... -->
1040
1040
<many-to-one field =" category"
1041
- target-entity =" products"
1041
+ target-entity =" Category"
1042
+ inversed-by =" products"
1042
1043
join-column =" category"
1043
1044
>
1044
1045
<join-column
@@ -1205,14 +1206,14 @@ to the given ``Category`` object via their ``category_id`` value.
1205
1206
1206
1207
The proxy classes are generated by Doctrine and stored in the cache directory.
1207
1208
And though you'll probably never even notice that your ``$category ``
1208
- object is actually a proxy object, it's important to keep in mind.
1209
+ object is actually a proxy object, it's important to keep it in mind.
1209
1210
1210
1211
In the next section, when you retrieve the product and category data
1211
1212
all at once (via a *join *), Doctrine will return the *true * ``Category ``
1212
1213
object, since nothing needs to be lazily loaded.
1213
1214
1214
- Joining to Related Records
1215
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
1215
+ Joining Related Records
1216
+ ~~~~~~~~~~~~~~~~~~~~~~~
1216
1217
1217
1218
In the above examples, two queries were made - one for the original object
1218
1219
(e.g. a ``Category ``) and one for the related object(s) (e.g. the ``Product ``
@@ -1304,7 +1305,7 @@ callbacks. This is not necessary if you're using YAML or XML for your mapping:
1304
1305
}
1305
1306
1306
1307
Now, you can tell Doctrine to execute a method on any of the available lifecycle
1307
- events. For example, suppose you want to set a ``created `` date column to
1308
+ events. For example, suppose you want to set a ``createdAt `` date column to
1308
1309
the current date, only when the entity is first persisted (i.e. inserted):
1309
1310
1310
1311
.. configuration-block ::
@@ -1314,9 +1315,9 @@ the current date, only when the entity is first persisted (i.e. inserted):
1314
1315
/**
1315
1316
* @ORM\PrePersist
1316
1317
*/
1317
- public function setCreatedValue ()
1318
+ public function setCreatedAtValue ()
1318
1319
{
1319
- $this->created = new \DateTime();
1320
+ $this->createdAt = new \DateTime();
1320
1321
}
1321
1322
1322
1323
.. code-block :: yaml
@@ -1326,7 +1327,7 @@ the current date, only when the entity is first persisted (i.e. inserted):
1326
1327
type : entity
1327
1328
# ...
1328
1329
lifecycleCallbacks :
1329
- prePersist : [setCreatedValue ]
1330
+ prePersist : [setCreatedAtValue ]
1330
1331
1331
1332
.. code-block :: xml
1332
1333
@@ -1339,18 +1340,18 @@ the current date, only when the entity is first persisted (i.e. inserted):
1339
1340
<!-- ... -->
1340
1341
<lifecycle-callbacks >
1341
1342
<lifecycle-callback type =" prePersist"
1342
- method =" setCreatedValue " />
1343
+ method =" setCreatedAtValue " />
1343
1344
</lifecycle-callbacks >
1344
1345
</entity >
1345
1346
</doctrine-mapping >
1346
1347
1347
1348
.. note ::
1348
1349
1349
- The above example assumes that you've created and mapped a ``created ``
1350
+ The above example assumes that you've created and mapped a ``createdAt ``
1350
1351
property (not shown here).
1351
1352
1352
1353
Now, right before the entity is first persisted, Doctrine will automatically
1353
- call this method and the ``created `` field will be set to the current date.
1354
+ call this method and the ``createdAt `` field will be set to the current date.
1354
1355
1355
1356
This can be repeated for any of the other lifecycle events, which include:
1356
1357
@@ -1368,7 +1369,7 @@ in general, see Doctrine's `Lifecycle Events documentation`_
1368
1369
1369
1370
.. sidebar :: Lifecycle Callbacks and Event Listeners
1370
1371
1371
- Notice that the ``setCreatedValue () `` method receives no arguments. This
1372
+ Notice that the ``setCreatedAtValue () `` method receives no arguments. This
1372
1373
is always the case for lifecycle callbacks and is intentional: lifecycle
1373
1374
callbacks should be simple methods that are concerned with internally
1374
1375
transforming data in the entity (e.g. setting a created/updated field,
0 commit comments