Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Sep 22, 2024
1 parent b2e9555 commit a1bee2e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/mapper/02-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,17 @@ you can add the service manually like this:
services:
App\Mapper\UserMapper:
tags:
-
name: 'rekalogika.mapper.property_mapper'
- name: 'rekalogika.mapper.property_mapper'
method: 'mapName'
sourceClass: 'App\Entity\User'
targetClass: 'App\Dto\UserDto'
property: 'name'
-
name: 'rekalogika.mapper.property_mapper'
- name: 'rekalogika.mapper.property_mapper'
method: 'mapBirthDate'
sourceClass: 'App\Entity\User'
targetClass: 'App\Dto\UserDto'
property: 'birthDate'
-
name: 'rekalogika.mapper.property_mapper'
- name: 'rekalogika.mapper.property_mapper'
method: 'mapEmail'
sourceClass: 'App\Entity\User'
targetClass: 'App\Dto\UserDto'
Expand Down Expand Up @@ -394,4 +391,13 @@ has explicit properties, then they will be respected as usual.

If the source is a `stdClass` (or an object with `#[AllowDynamicProperties]`)
and the target is a regular object, then the mapping will take place for each
property of the target that has a matching property on the source side.
property of the target that has a matching property on the source side.

## Classes With Overloading, or `__get()` and `__set()` Methods

Classes that use overloading, or have `__get()` and `__set()` methods generally
work the same way with Mapper as classes with dynamic properties as above.

You can have your `__get()` and `__set()` methods to throw
`BadMethodCallException` if you want to indicate that the property being
accessed does not exist.

0 comments on commit a1bee2e

Please sign in to comment.