@@ -85,18 +85,16 @@ information. By convention, this information is usually configured in an
8585 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
8686 xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
8787 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" >
8989
9090 <doctrine : config >
9191 <doctrine : dbal
9292 driver =" %database_driver%"
9393 host =" %database_host%"
9494 dbname =" %database_name%"
9595 user =" %database_user%"
96- password =" %database_password%"
97- />
96+ password =" %database_password%" />
9897 </doctrine : config >
99-
10098 </container >
10199
102100 .. code-block :: php
@@ -175,16 +173,14 @@ for you:
175173 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
176174 xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
177175 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" >
187177
178+ <doctrine : config >
179+ <doctrine : dbal
180+ driver =" pdo_sqlite"
181+ path =" %kernel.root_dir%/sqlite.db"
182+ charset =" UTF-8" />
183+ </doctrine : config >
188184 </container >
189185
190186 .. code-block :: php
@@ -319,17 +315,17 @@ in a number of different formats including YAML, XML or directly inside the
319315 <!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
320316 <?xml version =" 1.0" encoding =" UTF-8" ?>
321317 <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" >
325321
326322 <entity name =" Acme\StoreBundle\Entity\Product" table =" product" >
327- <id name =" id" type =" integer" column = " id " >
323+ <id name =" id" type =" integer" >
328324 <generator strategy =" AUTO" />
329325 </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" />
333329 </entity >
334330 </doctrine-mapping >
335331
@@ -826,13 +822,15 @@ To do this, add the name of the repository class to your mapping definition:
826822 <!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
827823 <?xml version =" 1.0" encoding =" UTF-8" ?>
828824 <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" >
832832
833- <entity name =" Acme\StoreBundle\Entity\Product"
834- repository-class =" Acme\StoreBundle\Entity\ProductRepository" >
835- <!-- ... -->
833+ <!-- ... -->
836834 </entity >
837835 </doctrine-mapping >
838836
@@ -945,17 +943,18 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
945943 .. code-block :: xml
946944
947945 <!-- src/Acme/StoreBundle/Resources/config/doctrine/Category.orm.xml -->
946+ <?xml version =" 1.0" encoding =" UTF-8" ?>
948947 <doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
949948 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
950949 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" >
952951
953952 <entity name =" Acme\StoreBundle\Entity\Category" >
954953 <!-- ... -->
955- <one-to-many field =" products"
954+ <one-to-many
955+ field =" products"
956956 target-entity =" Product"
957- mapped-by =" category"
958- />
957+ mapped-by =" category" />
959958
960959 <!--
961960 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:
10231022 .. code-block :: xml
10241023
10251024 <!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
1025+ <?xml version =" 1.0" encoding =" UTF-8" ?>
10261026 <doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
10271027 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
10281028 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" >
10301030
10311031 <entity name =" Acme\StoreBundle\Entity\Product" >
10321032 <!-- ... -->
1033- <many-to-one field =" category"
1033+ <many-to-one
1034+ field =" category"
10341035 target-entity =" Category"
10351036 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" />
10421040 </many-to-one >
10431041 </entity >
10441042 </doctrine-mapping >
@@ -1306,6 +1304,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
13061304
13071305 .. code-block :: php-annotations
13081306
1307+ // src/Acme/StoreBundle/Entity/Product.php
1308+
13091309 /**
13101310 * @ORM\PrePersist
13111311 */
@@ -1328,16 +1328,15 @@ the current date, only when the entity is first persisted (i.e. inserted):
13281328 <!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
13291329 <?xml version =" 1.0" encoding =" UTF-8" ?>
13301330 <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" >
13341334
13351335 <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 >
13411340 </entity >
13421341 </doctrine-mapping >
13431342
0 commit comments