Skip to content

Commit 20bd5cb

Browse files
committed
Minor tweaks
1 parent 4cb6ca8 commit 20bd5cb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

object_mapper.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ And the related target object must define the ``createFromLegacy()`` method::
431431
Mapping Collections
432432
-------------------
433433

434-
By default, ObjectMapper does not map arrays or traversable collections.
435-
To map each item in a collection (such as an array of DTOs to an array of entities), you **must** use the `MapCollection` transformer explicitly:
434+
By default, ObjectMapper does not map arrays or traversable collections. To map
435+
each item in a collection (for example, mapping an array of DTOs to an array of
436+
entities), you **must** explicitly use the ``MapCollection`` transformer:
436437

437438
Example::
438439

@@ -446,13 +447,13 @@ Example::
446447
public array $products;
447448
}
448449

449-
This configuration tells ObjectMapper to map each item in the `products` array using the usual mapping rules.
450-
451-
If you do not add `transform: new MapCollection()`, the array will be mapped as-is.
450+
With this configuration, ObjectMapper maps each item in the ``products`` array
451+
according to the usual mapping rules. Without ``transform: new MapCollection()``,
452+
the array is left unchanged.
452453

453454
.. versionadded:: 7.4
454455

455-
The MapCollection component was introduced in Symfony 7.4.
456+
The ``MapCollection`` transformer was introduced in Symfony 7.4.
456457

457458
Mapping Multiple Targets
458459
------------------------

0 commit comments

Comments
 (0)