-
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
Deprecate usage of @JoinColumn
on the inverse side of one-to-one associations
#10654
Merged
greg0ire
merged 1 commit into
doctrine:2.15.x
from
mpdude:join-column-does-not-make-it-own
Apr 26, 2023
Merged
Deprecate usage of @JoinColumn
on the inverse side of one-to-one associations
#10654
greg0ire
merged 1 commit into
doctrine:2.15.x
from
mpdude:join-column-does-not-make-it-own
Apr 26, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpdude
changed the title
Throw an exception when the inverse side configures the join column(s)
Deprecate usage of Apr 25, 2023
@JoinColumn
on the inverse side of one-to-one associations
mpdude
force-pushed
the
join-column-does-not-make-it-own
branch
from
April 25, 2023 09:50
c870020
to
63ff848
Compare
Tests will pass with the changes from #10652. |
derrabus
reviewed
Apr 25, 2023
derrabus
reviewed
Apr 25, 2023
mpdude
force-pushed
the
join-column-does-not-make-it-own
branch
2 times, most recently
from
April 25, 2023 12:00
d7bfd38
to
917a656
Compare
Something went wrong when rebasing this PR, apparently. The diff contains changes that have already been merged to 2.15.x. |
mpdude
force-pushed
the
join-column-does-not-make-it-own
branch
from
April 25, 2023 12:39
917a656
to
9b44181
Compare
greg0ire
reviewed
Apr 25, 2023
mpdude
force-pushed
the
join-column-does-not-make-it-own
branch
2 times, most recently
from
April 25, 2023 13:27
14f5b69
to
98177e4
Compare
…ciations Following up on doctrine#10652: #### Current situation The implementation of `\Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteOneToOneMapping` will consider a field with a one-to-one association to be the owning side also when it configures `@JoinColumn` settings. #### Suggested change For a one to one association, a field should be the inverse side when it uses the `mappedBy` attribute, and be the owning side otherwise. The `JoinColumn` may be configured on the owning side only. This PR adds a deprecation notice when `@JoinColumn` is used on the side of a one-to-one association where `mappedBy` occurs. In 3.0, this will throw a `MappingException`.
mpdude
force-pushed
the
join-column-does-not-make-it-own
branch
from
April 25, 2023 13:29
98177e4
to
aba8d74
Compare
greg0ire
approved these changes
Apr 26, 2023
Thanks @mpdude ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following up on #10652:
Current situation
The implementation of
\Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteOneToOneMapping
will consider a field with a one-to-one association to be the owning side also when it configures@JoinColumn
settings.Suggested change
For a one to one association, a field should be the inverse side when it uses the
mappedBy
attribute, and be the owning side otherwise. TheJoinColumn
may be configured on the owning side only.This PR adds a deprecation notice when
@JoinColumn
is used on the side of a one-to-one association wheremappedBy
occurs.In 3.0, this will throw a
MappingException
.