mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Misleading error message for bi-dir O:O with no mappedBy #6932
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?
Originally created by @kiler129 on GitHub (Feb 22, 2022).
Bug Report
Summary
Wrong validation message is displayed when an incorrect bidirectional one-to-one mapping is set up. When the owning side is configured correctly and the target side is missing the back reference the ORM suggests adding
inverseByinstead ofmappedBy.I may be wrong, but adding such
inversedBycreates another error in the mapping, while usingmappedByresults in mapping passing the validation.Current behavior
How to reproduce
bin/console doctrine:schema:validateExpected behavior
I believe that the message should suggest adding
mappedByand notinversedBy, as according to the docs, the owning side needsinversedBywhile the target side usesmappedBy. In addition it seems like the target entity reference should contain a field which is missing (nothing after#).With both fixed the message will look like the following:
See PR https://github.com/doctrine/orm/pull/9537