File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 1.2.3
4+ - Register services in bundle extension file
5+ - Fix exceptions issues
6+ - Add .gitattributes
7+
38## 1.2.2
49- Handle deserialization exceptions
510- Update composer.json minimum-stability
Original file line number Diff line number Diff line change 77
88- Request data supported: ` json ` , ` xml ` and ` form ` based on header content type.
99- Resolve inputs arguments for controllers actions.
10+ - Create DTO inputs outside controllers
1011- Validate DTO inputs objects.
1112- Global YAML configuration.
1213- Custom Configuration via Input Attribute per controller action.
@@ -86,7 +87,7 @@ Content-Type: application/problem+json; charset=utf-8
8687}
8788```
8889
89- ### Deserialization (v1.2.2)
90+ ### Deserialization
9091
9192Whether the request data contains invalid syntax or invalid attributes types a clear 400 json response will return:
9293
@@ -126,6 +127,34 @@ request_input:
126127
127128You can also override the format using attribute input and specify the format explicitly.
128129
130+ ### Create DTO input outside controller
131+
132+ You just need to inject ` InputFactoryInterface` e.g:
133+ ` ` ` php
134+ <?php
135+
136+ declare(strict_types=1);
137+
138+ namespace App\M anager;
139+
140+ use App\D to\P ostInput;
141+ use Sfmok\R equestInput\I nputInterface;
142+ use Symfony\C omponent\H ttpFoundation\R equest;
143+ use Sfmok\R equestInput\F actory\I nputFactoryInterface;
144+
145+ class PostManager
146+ {
147+ public function __construct(private InputFactoryInterface $inputFactory)
148+ {
149+ }
150+
151+ public function getInput(Request $request): InputInterface
152+ {
153+ return $this->inputFactory->createFromRequest($request, PostInput::class, 'json');
154+ }
155+ }
156+ ` ` `
157+
129158# # License
130159
131160The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
You can’t perform that action at this time.
0 commit comments