mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #10654] Deprecate usage of @JoinColumn on the inverse side of one-to-one associations
#12520
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/10654
State: closed
Merged: Yes
Following up on #10652:
Current situation
The implementation of
\Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteOneToOneMappingwill consider a field with a one-to-one association to be the owning side also when it configures@JoinColumnsettings.Suggested change
For a one to one association, a field should be the inverse side when it uses the
mappedByattribute, and be the owning side otherwise. TheJoinColumnmay be configured on the owning side only.This PR adds a deprecation notice when
@JoinColumnis used on the side of a one-to-one association wheremappedByoccurs.In 3.0, this will throw a
MappingException.