@@ -78,7 +78,7 @@ Configure property mapping
78
78
79
79
Use the :class: `Symfony\\ Component\\ ObjectMapper\\ Attribute\\ Map ` attribute on properties to configure property mapping between
80
80
objects. ``target `` changes the target property, ``if `` allows to
81
- conditionnally map properties::
81
+ conditionally map properties::
82
82
83
83
// src/Dto/Source.php
84
84
namespace App\Dto;
@@ -97,9 +97,9 @@ Transform mapped values
97
97
-----------------------
98
98
99
99
Use ``transform `` to call a function or a
100
- :class: `Symfony\C omponent\O bjectMapper\C allableInterface `::
100
+ :class: `Symfony\\ Component\\ ObjectMapper\ \ CallableInterface `::
101
101
102
- // src/ObjectMapper/TransformNameCallable
102
+ // src/ObjectMapper/TransformNameCallable.php
103
103
namespace App\ObjectMapper;
104
104
105
105
use App\Dto\Source;
@@ -157,7 +157,8 @@ classes and it can be repeated::
157
157
158
158
#[Map(target: B::class, if: [Source::class, 'shouldMapToB'])]
159
159
#[Map(target: C::class, if: [Source::class, 'shouldMapToC'])]
160
- class Source {
160
+ class Source
161
+ {
161
162
public static function shouldMapToB(mixed $value, object $object): bool
162
163
{
163
164
return false;
@@ -248,13 +249,12 @@ With this metadata usage, the mapping definition belongs to a mapper class::
248
249
}
249
250
250
251
251
- The custom metadata is injected inside our :class: `Symfony\\ Component\\ ObjectMapper\\ ObjectMapperInterface `::
252
+ The custom metadata is injected into our :class: `Symfony\\ Component\\ ObjectMapper\\ ObjectMapperInterface `::
252
253
253
254
$a = new Source('a', 'b', 'c');
254
255
$metadata = new MapStructMapperMetadataFactory(AToBMapper::class);
255
256
$mapper = new ObjectMapper($metadata);
256
257
$aToBMapper = new AToBMapper($mapper);
257
258
$b = $aToBMapper->map($a);
258
259
259
-
260
260
.. _`MapStruct` : https://mapstruct.org/
0 commit comments