Skip to content

Commit

Permalink
Add default value section
Browse files Browse the repository at this point in the history
  • Loading branch information
jan888adams committed Oct 9, 2023
1 parent f3255b3 commit 01d1660
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ with `phone` (property of the source object).

> Note: the source and the target property must be of the same type for this to work.
In order to set a default value for a property, you can use the `default` keyword:

```yaml
# config/packages/neusta_converter.yaml
neusta_converter:
converter:
person.converter:
properties:
# ...
phoneNumber:
source: phone
default: 0123456789
```

The converter will set the value of `phoneNumber` (property of the target object) to `0123456789` if
the value of `phone` (property of the source object) is null.

#### Mapping context

If you just want to map a single property from the context to the target without transforming it in between, you don't
Expand Down

0 comments on commit 01d1660

Please sign in to comment.