Skip to content

Commit ef60b73

Browse files
committed
Improve and fix TypedFieldMapper docs
1 parent 30a2680 commit ef60b73

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/en/reference/typedfieldmapper.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ Implementing a TypedFieldMapper
33

44
.. versionadded:: 2.14
55

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``
77
and a custom ``Doctrine\ORM\Mapping\TypedFieldMapper`` implementation.
88

99
.. code-block:: php
1010
1111
<?php
12-
1312
$configuration->setTypedFieldMapper(new CustomTypedFieldMapper());
1413
1514
@@ -25,7 +24,7 @@ PHP type => DBAL type mappings into its constructor to override the default beha
2524
use App\CustomIds\CustomIdObject;
2625
use App\DBAL\Type\CustomIdObjectType;
2726
28-
$configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
27+
$configuration->setTypedFieldMapper(new Doctrine\ORM\Mapping\DefaultTypedFieldMapper([
2928
CustomIdObject::class => CustomIdObjectType::class,
3029
]));
3130
@@ -85,7 +84,7 @@ It is perfectly valid to override even the "automatic" mapping rules mentioned a
8584
<?php
8685
use App\DBAL\Type\CustomIntType;
8786
88-
$configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
87+
$configuration->setTypedFieldMapper(new Doctrine\ORM\Mapping\DefaultTypedFieldMapper([
8988
'int' => CustomIntType::class,
9089
]));
9190
@@ -128,8 +127,8 @@ the instances were supplied to the ``ChainTypedFieldMapper`` constructor.
128127
use App\DBAL\Type\CustomIntType;
129128
130129
$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,]),
133132
new CustomTypedFieldMapper()
134133
)
135134
);
@@ -173,4 +172,4 @@ You need to create a class which implements ``Doctrine\ORM\Mapping\TypedFieldMap
173172

174173
Note that this case checks whether the mapping is already assigned, and if yes, it skips it. This is up to your
175174
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

Comments
 (0)