Skip to content
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

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Jan 15, 2023

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.

@greg0ire greg0ire force-pushed the field-mapping-improvements branch from 2ad64a9 to d212713 Compare January 15, 2023 20:00
@greg0ire
Copy link
Member Author

@michnovka please review

Copy link
Contributor

@michnovka michnovka left a 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.
Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Member Author

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"

Copy link
Contributor

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.

Copy link
Member Author

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 👍

Copy link
Contributor

@michnovka michnovka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now

@greg0ire greg0ire added this to the 2.15.0 milestone Jan 17, 2023
@greg0ire greg0ire merged commit a5bdc61 into doctrine:2.15.x Jan 17, 2023
@greg0ire greg0ire deleted the field-mapping-improvements branch January 17, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants