Skip to content

Commit 34bc2f8

Browse files
committed
fix: Updated readme
1 parent bde92ab commit 34bc2f8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,31 @@ The behavior of the `#[TargetProperty()]` attribute depends on the class in whic
2828

2929
###### legend: ✖️ - *has no effect*, ✔️ - *affects*, ➖ - *not implemented*
3030

31+
#### Usage
32+
33+
```php
34+
use PBaszak\UltraMapper\Mapper\Application\Attribute\TargetProperty;
35+
36+
class SourceClass {
37+
#[TargetProperty(name: "mappedProperty")]
38+
public string $originalProperty;
39+
}
40+
41+
class TargetClass {
42+
public string $mappedProperty;
43+
}
44+
```
45+
3146
## How it works
3247

33-
// in progress
48+
The Ultra Mapper library operates based on blueprints and attributes to map, normalize, denormalize, and transform data between various formats. Here's a step-by-step overview of each process:
49+
50+
1. **Normalization**: Converts a class object into an anonymous object, associative array, or flat array.
51+
2. **Denormalization**: Converts an anonymous object, associative array, or flat array back into a class object.
52+
3. **Mapping**: Maps data from one class object to another, e.g., DTO to entity.
53+
4. **Transformation**: Converts an anonymous object, associative array, or flat array to another structure of the same type.
54+
55+
The `TargetProperty` attribute is used to specify how properties are mapped or transformed, ensuring that the correct properties are connected even if their names differ.
3456

3557
## Performance Report
3658

0 commit comments

Comments
 (0)