Skip to content

Revert "Fix fields of transient classes being considered duplicate with reportFieldsWhereDeclared (#11769)"#12212

Merged
greg0ire merged 1 commit intodoctrine:2.20.xfrom
mpdude:revert-11769
Oct 10, 2025
Merged

Revert "Fix fields of transient classes being considered duplicate with reportFieldsWhereDeclared (#11769)"#12212
greg0ire merged 1 commit intodoctrine:2.20.xfrom
mpdude:revert-11769

Conversation

@mpdude
Copy link
Copy Markdown
Contributor

@mpdude mpdude commented Oct 9, 2025

Following up on #11769 (comment), I would like to revert the changes made in 4feaa47 (#11769).

Basically, it is wrong to allow fields from transient classes to be parsed and used for mapping configuration. This has happened and worked in the past, although it was never really endorsed or officially allowed by the documentation.

By adding the reportFieldsWhereDeclared opt-in switch (#10455), we were starting to enforce stricter configuration checks that help us to prevent other, strange errors further down the road. So, 4feaa47 was a step in the wrong direction.

@greg0ire greg0ire added this to the 2.20.7 milestone Oct 10, 2025
@greg0ire greg0ire added the Bug label Oct 10, 2025
@greg0ire greg0ire merged commit 930a790 into doctrine:2.20.x Oct 10, 2025
74 checks passed
@greg0ire
Copy link
Copy Markdown
Member

Thanks @mpdude !


if ($this->isTransient($declaringClass)) {
return isset($metadata->fieldMappings[$property->name]);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

removing this condition is breaking my project, check this issue #12246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants