@@ -17,7 +17,7 @@ with the most popular relational databases. In other words, the DBAL library
17
17
makes it easy to execute queries and perform other database actions.
18
18
19
19
.. tip ::
20
-
20
+
21
21
Read the official Doctrine `DBAL Documentation `_ to learn all the details
22
22
and capabilities of Doctrine's DBAL library.
23
23
@@ -37,7 +37,7 @@ To get started, configure the database connection parameters:
37
37
charset : UTF8
38
38
39
39
.. code-block :: xml
40
-
40
+
41
41
// app/config/config.xml
42
42
<doctrine : config >
43
43
<doctrine : dbal
@@ -97,6 +97,63 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document
97
97
custom_first : Acme\HelloBundle\Type\CustomFirst
98
98
custom_second : Acme\HelloBundle\Type\CustomSecond
99
99
100
+ .. code-block :: xml
101
+
102
+ <!-- app/config/config.xml -->
103
+ <container xmlns =" http://symfony.com/schema/dic/services"
104
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
105
+ xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
106
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
107
+ http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
108
+
109
+ <doctrine : config >
110
+ <doctrine : dbal >
111
+ <doctrine : dbal default-connection =" default" >
112
+ <doctrine : connection >
113
+ <doctrine : mapping-type name =" enum" >string</doctrine : mapping-type >
114
+ </doctrine : connection >
115
+ </doctrine : dbal >
116
+ </doctrine : config >
117
+ </container >
118
+
119
+ .. code-block :: php
120
+
121
+ // app/config/config.php
122
+ $container->loadFromExtension('doctrine', array(
123
+ 'dbal' => array(
124
+ 'connections' => array(
125
+ 'default' => array(
126
+ 'mapping_types' => array(
127
+ 'enum' => 'string',
128
+ ),
129
+ ),
130
+ ),
131
+ ),
132
+ ));
133
+
134
+ Registering Custom Mapping Types in the SchemaTool
135
+ --------------------------------------------------
136
+
137
+ The SchemaTool is used to inspect the database to compare the schema. To
138
+ achieve this task, it needs to know which mapping type needs to be used
139
+ for each database types. Registering new ones can be done through the configuration.
140
+
141
+ Let's map the ENUM type (not suppoorted by DBAL by default) to a the ``string ``
142
+ mapping type:
143
+
144
+ .. configuration-block ::
145
+
146
+ .. code-block :: yaml
147
+
148
+ # app/config/config.yml
149
+ doctrine :
150
+ dbal :
151
+ connection :
152
+ default :
153
+ // Other connections parameters
154
+ mapping_types :
155
+ enum : string
156
+
100
157
.. code-block :: xml
101
158
102
159
<!-- app/config/config.xml -->
@@ -115,7 +172,7 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document
115
172
</container >
116
173
117
174
.. code-block :: php
118
-
175
+
119
176
// app/config/config.php
120
177
$container->loadFromExtension('doctrine', array(
121
178
'dbal' => array(
0 commit comments