-
Notifications
You must be signed in to change notification settings - Fork 22
fix(constructor): better check for property exists when building constructor args #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public function testConstructorAndRelationMissing(): void | ||
| { | ||
| $user = ['name' => 'foo']; | ||
| $this->expectException(MissingConstructorArgumentsException::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added this, from the input this is the expected use case
|
|
||
| public function testConstructorAndRelationMissing2(): void | ||
| { | ||
| $user = ['name' => 'foo', 'int' => ['foo' => 1]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the input array, passing an Object will not work as we expecte pure base type when mapping from array, if there is something else then a transformer should be provided
| /** @var Fixtures\UserConstructorDTOWithRelation $userDto */ | ||
| $userDto = $this->autoMapper->map($user, Fixtures\UserConstructorDTOWithRelation::class, [ | ||
| MapperContext::CONSTRUCTOR_ARGUMENTS => [ | ||
| Fixtures\UserConstructorDTOWithRelation::class => ['int' => new Fixtures\IntDTO(1)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class was wrong, i put the correct one and it works as expected
|
Thanks 👍🏼 |
|
thanks 👍🏼 |
No description provided.