Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Apr 21, 2021
1 parent e1d8029 commit 0ef102a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ $postData

It's important to note that `except()` and `only()` are immutable, they won't change the original data transfer object.

## Immutable DTOs and cloning

This package doesn't force immutable objects since PHP doesn't support them, but you're always encouraged to keep your DTOs immutable. To help you, there's a `clone` method on every DTO which accepts data to override:

```php
$clone = $original->clone(other: ['name' => 'a']);
```

Note that no data in `$original` is changed.

## Collections of DTOs

This version removes the `DataTransferObjectCollection` class. Instead you can use simple casters and you own collection classes.
Expand Down

0 comments on commit 0ef102a

Please sign in to comment.