Skip to content

Commit af6b580

Browse files
committed
Docs: raw value tracking
1 parent 855a5c3 commit af6b580

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ of them to type-safe objects.
5050
- [Object creator](#object-creator)
5151
- [Create without constructor](#create-without-constructor)
5252
- [Metadata validation and preloading](#metadata-validation-and-preloading)
53+
- [Tracking input values](#tracking-input-values)
5354

5455
## Setup
5556

@@ -1751,3 +1752,28 @@ $metaLoader->preloadFromPaths([
17511752
__DIR__ . '/path2',
17521753
]);
17531754
```
1755+
1756+
## Tracking input values
1757+
1758+
Track input values of every mapped object in hierarchy, before they were processed by rules.
1759+
1760+
> Use only for debugging, because this may be memory intensive
1761+
1762+
```php
1763+
use Orisai\ObjectMapper\Processing\Options;
1764+
1765+
$initialValues = [];
1766+
1767+
$options = new Options();
1768+
$options->setTrackRawValues(true);
1769+
$object = $processor->process($initialValues, TrackedInput::class, $options);
1770+
1771+
$values = $processor->getRawValues($object); // mixed
1772+
$values === $initialValues; // true
1773+
```
1774+
1775+
To make it work,following conditions must be met:
1776+
1777+
- object was mapped by object mapper (no manually created objects)
1778+
- it was mapped in current php process (no serialization)
1779+
- option is set to enable raw values tracking

0 commit comments

Comments
 (0)