-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Field mapping improvements #10408
Field mapping improvements #10408
Conversation
2ad64a9
to
d212713
Compare
@michnovka please review |
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.
have a look at my review
@@ -1584,7 +1586,7 @@ private function isTypedProperty(string $name): bool | |||
* | |||
* @param array{fieldName: string, type?: mixed} $mapping The field mapping to validate & complete. |
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.
if we update return type, we should update the type?: string
here in param too
@@ -1628,7 +1630,7 @@ private function validateAndCompleteTypedAssociationMapping(array $mapping): arr | |||
* enumType?: class-string, | |||
* } $mapping The field mapping to validate & complete. | |||
* | |||
* @return mixed[] The updated mapping. | |||
* @return FieldMapping The updated mapping. |
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.
FieldMapping type has a compulsory array-key columnName
. I am not sure that this is satisfied here, as the function does not set it and @param $mapping does not specify it.
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.
It's satisfied right below the comment "Complete fieldName and columnName mapping"
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.
sorry, my bad I was working on some badly lined version in my local repo.
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.
No worries, and thanks for reviewing 👍
d212713
to
c0a7317
Compare
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.
looks good now
It will be hard to finish #10405, but this should get us closer to it.
Also, I learnt that DTOs shouldn't be used in mapping drivers, because drivers produce incomplete field mappings (they might not have a type), and also produce mapping overrides that might have even fewer fields. DTOs should be used in the class metadata and its consumers.