File tree Expand file tree Collapse file tree 2 files changed +1118
-188
lines changed Expand file tree Collapse file tree 2 files changed +1118
-188
lines changed Original file line number Diff line number Diff line change 29
29
30
30
##
31
31
32
+ <details open >
33
+ <summary>Attributes definition</summary>
34
+
35
+ ``` php
36
+ use Orisai\ObjectMapper\MappedObject;
37
+ use Orisai\ObjectMapper\Rules\MappedObjectValue;
38
+ use Orisai\ObjectMapper\Rules\StringValue;
39
+
40
+ final class UserInput implements MappedObject
41
+ {
42
+
43
+ #[StringValue(notEmpty: true)]
44
+ public string $firstName;
45
+
46
+ #[StringValue(notEmpty: true)]
47
+ public string $lastName;
48
+
49
+ #[MappedObjectValue(UserAddressInput::class)]
50
+ public UserAddressInput $address;
51
+
52
+ }
53
+ ```
54
+
55
+ ``` php
56
+ use Orisai\ObjectMapper\MappedObject;
57
+ use Orisai\ObjectMapper\Rules\StringValue;
58
+
59
+ final class UserAddressInput implements MappedObject
60
+ {
61
+
62
+ #[StringValue(notEmpty: true)]
63
+ public string $street;
64
+
65
+ // ...
66
+ }
67
+ ```
68
+ </details >
69
+
70
+ <details >
71
+ <summary>Annotations definition</summary>
72
+
32
73
``` php
33
74
use Orisai\ObjectMapper\MappedObject;
34
75
use Orisai\ObjectMapper\Rules\MappedObjectValue;
@@ -62,6 +103,10 @@ final class UserAddressInput implements MappedObject
62
103
// ...
63
104
}
64
105
```
106
+ </details >
107
+
108
+ <details open >
109
+ <summary>Processing</summary>
65
110
66
111
``` php
67
112
use Orisai\ObjectMapper\Exception\InvalidData;
90
135
91
136
echo "User name is: {$user->firstName} {$user->lastName}";
92
137
```
138
+ </details >
You can’t perform that action at this time.
0 commit comments