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 e238339
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,25 @@ 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:
email:
source: ~
default: unknown
phoneNumber:
source: phone
default: 0123456789
```

Which will populate `email` with the value of the source property `email` or with the default value `unknown` if the
source property 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 e238339

Please sign in to comment.