File tree Expand file tree Collapse file tree 3 files changed +52
-1
lines changed
tests/AutoMapperTest/Issue269 Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ public function getTypes(string $target): ?array
161161 $ reflectionMethod ->getDocComment (),
162162 $ target ,
163163 $ reflectionMethod ->getDeclaringClass ()->getName (),
164- $ this -> property ,
164+ $ reflectionMethod -> getParameters ()[ 0 ]-> name ,
165165 '@param '
166166 )) {
167167 return $ types ;
Original file line number Diff line number Diff line change 1+ AutoMapper\Tests\AutoMapperTest\Issue269\Entity {
2+ -paymentMethods: [
3+ AutoMapper\Tests\AutoMapperTest\Issue269\PaymentMethod {
4+ +name: "First"
5+ +value: "First"
6+ }
7+ ]
8+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace AutoMapper \Tests \AutoMapperTest \Issue269 ;
6+
7+ use AutoMapper \Tests \AutoMapperBuilder ;
8+
9+ enum PaymentMethod: string
10+ {
11+ case First = 'First ' ;
12+ }
13+
14+ class Dto
15+ {
16+ /** @var PaymentMethod[] */
17+ public ?array $ paymentMethods = null ;
18+ }
19+
20+ class Entity
21+ {
22+ /** @var PaymentMethod[] */
23+ private array $ paymentMethods = [];
24+
25+ /** @param PaymentMethod[] $paymentMethods */
26+ public function setPaymentMethods (array $ paymentMethods ): self
27+ {
28+ $ this ->paymentMethods = $ paymentMethods ;
29+
30+ return $ this ;
31+ }
32+
33+ /** @return PaymentMethod[] */
34+ public function getPaymentMethods (): array
35+ {
36+ return $ this ->paymentMethods ;
37+ }
38+ }
39+
40+ $ dto = new Dto ();
41+ $ dto ->paymentMethods = [PaymentMethod::First];
42+
43+ return AutoMapperBuilder::buildAutoMapper ()->map ($ dto , Entity::class);
You can’t perform that action at this time.
0 commit comments