@@ -3,13 +3,12 @@ Implementing a TypedFieldMapper
3
3
4
4
.. versionadded :: 2.14
5
5
6
- You can specify custom typed field mapping between PHP type and DBAL type using ``Configuration ``
6
+ You can specify custom typed field mapping between PHP type and DBAL type using ``Doctrine\ORM\ Configuration ``
7
7
and a custom ``Doctrine\ORM\Mapping\TypedFieldMapper `` implementation.
8
8
9
9
.. code-block :: php
10
10
11
11
<?php
12
-
13
12
$configuration->setTypedFieldMapper(new CustomTypedFieldMapper());
14
13
15
14
@@ -25,7 +24,7 @@ PHP type => DBAL type mappings into its constructor to override the default beha
25
24
use App\CustomIds\CustomIdObject;
26
25
use App\DBAL\Type\CustomIdObjectType;
27
26
28
- $configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
27
+ $configuration->setTypedFieldMapper(new Doctrine\ORM\Mapping\ DefaultTypedFieldMapper([
29
28
CustomIdObject::class => CustomIdObjectType::class,
30
29
]));
31
30
@@ -85,7 +84,7 @@ It is perfectly valid to override even the "automatic" mapping rules mentioned a
85
84
<?php
86
85
use App\DBAL\Type\CustomIntType;
87
86
88
- $configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
87
+ $configuration->setTypedFieldMapper(new Doctrine\ORM\Mapping\ DefaultTypedFieldMapper([
89
88
'int' => CustomIntType::class,
90
89
]));
91
90
@@ -128,8 +127,8 @@ the instances were supplied to the ``ChainTypedFieldMapper`` constructor.
128
127
use App\DBAL\Type\CustomIntType;
129
128
130
129
$configuration->setTypedFieldMapper(
131
- new ChainTypedFieldMapper(
132
- DefaultTypedFieldMapper(['int' => CustomIntType::class,]),
130
+ new Doctrine\ORM\Mapping\ ChainTypedFieldMapper(
131
+ new Doctrine\ORM\Mapping\ DefaultTypedFieldMapper(['int' => CustomIntType::class,]),
133
132
new CustomTypedFieldMapper()
134
133
)
135
134
);
@@ -173,4 +172,4 @@ You need to create a class which implements ``Doctrine\ORM\Mapping\TypedFieldMap
173
172
174
173
Note that this case checks whether the mapping is already assigned, and if yes, it skips it. This is up to your
175
174
implementation. You can make a "greedy" mapper which will always override the mapping with its own type, or one
176
- that behaves like ``DefaultTypedFieldMapper `` and does not modify the type once its set prior in the chain.
175
+ that behaves like the ``DefaultTypedFieldMapper `` and does not modify the type once its set prior in the chain.
0 commit comments