@@ -85,18 +85,16 @@ information. By convention, this information is usually configured in an
85
85
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
86
86
xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
87
87
xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
88
- http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
88
+ http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
89
89
90
90
<doctrine : config >
91
91
<doctrine : dbal
92
92
driver =" %database_driver%"
93
93
host =" %database_host%"
94
94
dbname =" %database_name%"
95
95
user =" %database_user%"
96
- password =" %database_password%"
97
- />
96
+ password =" %database_password%" />
98
97
</doctrine : config >
99
-
100
98
</container >
101
99
102
100
.. code-block :: php
@@ -175,16 +173,14 @@ for you:
175
173
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
176
174
xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
177
175
xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
178
- http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
179
-
180
- <doctrine : config
181
- driver =" pdo_sqlite"
182
- path =" %kernel.root_dir%/sqlite.db"
183
- charset =" UTF-8"
184
- >
185
- <!-- ... -->
186
- </doctrine : config >
176
+ http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
187
177
178
+ <doctrine : config >
179
+ <doctrine : dbal
180
+ driver =" pdo_sqlite"
181
+ path =" %kernel.root_dir%/sqlite.db"
182
+ charset =" UTF-8" />
183
+ </doctrine : config >
188
184
</container >
189
185
190
186
.. code-block :: php
@@ -319,17 +315,17 @@ in a number of different formats including YAML, XML or directly inside the
319
315
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
320
316
<?xml version =" 1.0" encoding =" UTF-8" ?>
321
317
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
322
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
323
- xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
324
- http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
318
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
319
+ xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
320
+ http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
325
321
326
322
<entity name =" Acme\StoreBundle\Entity\Product" table =" product" >
327
- <id name =" id" type =" integer" column = " id " >
323
+ <id name =" id" type =" integer" >
328
324
<generator strategy =" AUTO" />
329
325
</id >
330
- <field name =" name" column = " name " type =" string" length =" 100" />
331
- <field name =" price" column = " price " type =" decimal" scale =" 2" />
332
- <field name =" description" column = " description " type =" text" />
326
+ <field name =" name" type =" string" length =" 100" />
327
+ <field name =" price" type =" decimal" scale =" 2" />
328
+ <field name =" description" type =" text" />
333
329
</entity >
334
330
</doctrine-mapping >
335
331
@@ -826,13 +822,15 @@ To do this, add the name of the repository class to your mapping definition:
826
822
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
827
823
<?xml version =" 1.0" encoding =" UTF-8" ?>
828
824
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
829
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
830
- xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
831
- http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
825
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
826
+ xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
827
+ http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
828
+
829
+ <entity
830
+ name =" Acme\StoreBundle\Entity\Product"
831
+ repository-class =" Acme\StoreBundle\Entity\ProductRepository" >
832
832
833
- <entity name =" Acme\StoreBundle\Entity\Product"
834
- repository-class =" Acme\StoreBundle\Entity\ProductRepository" >
835
- <!-- ... -->
833
+ <!-- ... -->
836
834
</entity >
837
835
</doctrine-mapping >
838
836
@@ -945,17 +943,18 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
945
943
.. code-block :: xml
946
944
947
945
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Category.orm.xml -->
946
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
948
947
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
949
948
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
950
949
xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
951
- http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
950
+ http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
952
951
953
952
<entity name =" Acme\StoreBundle\Entity\Category" >
954
953
<!-- ... -->
955
- <one-to-many field =" products"
954
+ <one-to-many
955
+ field =" products"
956
956
target-entity =" Product"
957
- mapped-by =" category"
958
- />
957
+ mapped-by =" category" />
959
958
960
959
<!--
961
960
don't forget to init the collection in
@@ -1023,22 +1022,21 @@ object, you'll want to add a ``$category`` property to the ``Product`` class:
1023
1022
.. code-block :: xml
1024
1023
1025
1024
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
1025
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
1026
1026
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
1027
1027
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1028
1028
xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
1029
- http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
1029
+ http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
1030
1030
1031
1031
<entity name =" Acme\StoreBundle\Entity\Product" >
1032
1032
<!-- ... -->
1033
- <many-to-one field =" category"
1033
+ <many-to-one
1034
+ field =" category"
1034
1035
target-entity =" Category"
1035
1036
inversed-by =" products"
1036
- join-column =" category"
1037
- >
1038
- <join-column
1039
- name =" category_id"
1040
- referenced-column-name =" id"
1041
- />
1037
+ join-column =" category" >
1038
+
1039
+ <join-column name =" category_id" referenced-column-name =" id" />
1042
1040
</many-to-one >
1043
1041
</entity >
1044
1042
</doctrine-mapping >
@@ -1306,6 +1304,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
1306
1304
1307
1305
.. code-block :: php-annotations
1308
1306
1307
+ // src/Acme/StoreBundle/Entity/Product.php
1308
+
1309
1309
/**
1310
1310
* @ORM\PrePersist
1311
1311
*/
@@ -1328,16 +1328,15 @@ the current date, only when the entity is first persisted (i.e. inserted):
1328
1328
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
1329
1329
<?xml version =" 1.0" encoding =" UTF-8" ?>
1330
1330
<doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
1331
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1332
- xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
1333
- http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
1331
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1332
+ xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
1333
+ http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" >
1334
1334
1335
1335
<entity name =" Acme\StoreBundle\Entity\Product" >
1336
- <!-- ... -->
1337
- <lifecycle-callbacks >
1338
- <lifecycle-callback type =" prePersist"
1339
- method =" setCreatedAtValue" />
1340
- </lifecycle-callbacks >
1336
+ <!-- ... -->
1337
+ <lifecycle-callbacks >
1338
+ <lifecycle-callback type =" prePersist" method =" setCreatedAtValue" />
1339
+ </lifecycle-callbacks >
1341
1340
</entity >
1342
1341
</doctrine-mapping >
1343
1342
0 commit comments