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 2929
3030##
3131
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+
3273``` php
3374use Orisai\ObjectMapper\MappedObject;
3475use Orisai\ObjectMapper\Rules\MappedObjectValue;
@@ -62,6 +103,10 @@ final class UserAddressInput implements MappedObject
62103 // ...
63104}
64105```
106+ </details >
107+
108+ <details open >
109+ <summary>Processing</summary>
65110
66111``` php
67112use Orisai\ObjectMapper\Exception\InvalidData;
90135
91136echo "User name is: {$user->firstName} {$user->lastName}";
92137```
138+ </details >
You can’t perform that action at this time.
0 commit comments