|
16 | 16 | [](https://codecov.io/github/wundii/data-mapper-symfony-bundle)
|
17 | 17 | [](https://packagist.org/packages/wundii/data-mapper-symfony-bundle)
|
18 | 18 |
|
19 |
| -A Symfony integration for [wundii/data-mapper](https://github.com/wundii/data-mapper). |
20 |
| -This library is an extremely fast and strictly typed object mapper built for modern PHP (8.2+). |
| 19 | +A Symfony integration for [wundii/data-mapper](https://github.com/wundii/data-mapper). |
| 20 | +This library is an extremely fast and strictly typed object mapper built for modern PHP (8.2+). |
21 | 21 | It seamlessly transforms data from formats like CSV, JSON, NEON, XML, YAML, array, and standard objects into well-structured PHP objects.
|
22 | 22 |
|
23 | 23 | Ideal for developers who need reliable and efficient data mapping without sacrificing code quality or modern best practices.
|
@@ -91,7 +91,7 @@ data_mapper:
|
91 | 91 | data_config:
|
92 | 92 | approach: 'CONSTRUCTOR|PROPERTY|SETTER' # ApproachEnum::SETTER
|
93 | 93 | accessible: 'PRIVATE|PUBLIC' # AccessibleEnum::PUBLIC
|
94 |
| - class_map: |
| 94 | + class_map: |
95 | 95 | InterfaceOrClassName: 'ClassName', # Class mapping for interfaces or other classes
|
96 | 96 | ...: ...
|
97 | 97 | ```
|
@@ -124,14 +124,14 @@ final class YourController extends AbstractController
|
124 | 124 | // Automatic recognition of the format based on the content type of the request
|
125 | 125 | // returns an instance of TestClass or an Exception
|
126 | 126 | $testClass = $this->dataMapper->request($request, TestClass::class);
|
127 |
| - |
| 127 | + |
128 | 128 | // or you can use tryRequest to avoid exceptions, null will be returned instead
|
129 | 129 | $testClass = $this->dataMapper->tryRequest($request, TestClass::class);
|
130 | 130 | $this->dataMapper->getMapStatusEnum();
|
131 | 131 | $this->dataMapper->getErrorMessage();
|
132 |
| - |
| 132 | + |
133 | 133 | // Do something with $testClass
|
134 |
| - |
| 134 | + |
135 | 135 | return $this->json(...);
|
136 | 136 | }
|
137 | 137 | }
|
@@ -164,10 +164,10 @@ final class YourController extends AbstractController
|
164 | 164 | {
|
165 | 165 | // you can use the native DataMapper methods directly
|
166 | 166 | $testClass = $this->dataMapper->json($request->getContent(), TestClass::class);
|
167 |
| - |
| 167 | + |
168 | 168 | // Do something with $testClass
|
169 |
| - |
| 169 | + |
170 | 170 | return $this->json(...);
|
171 | 171 | }
|
172 | 172 | }
|
173 |
| -``` |
| 173 | +``` |
0 commit comments