Closed withinboredom closed 8 months ago
you have #[OneToOne(inversedBy: 'locale', targetEntity: SupportedLocale::class)]
in DomainSettings, but locale
is not the inverse relation in SupportedLocale. So your mapping is invalid. You should not use inversedBy
if there is no inverse side.
The issue in your case is that you tell DomainSettings that this is a bidirectional relation, not a unidirectional one.
Note that this is something that the schema validator can detect.
In a Symfony project, you can run bin/console doctrine:schema:validate
to run this validator (and I recommend running this command as one of your CI jobs)
Note that this is something that the schema validator can detect.
TIL. Thanks for sharing!
your mapping is invalid
Yep! I figured it out, but forgot to close the issue!
Bug Report
Summary
In trying to define a simple-ish denormalized mappings of some objects, I stumbled across a bug where it will fail to denormalize a unidirectional association if both sides do not define the association, multiple associations exist, and composite keys are involved.
Current behavior
Errors and warnings are returned:
How to reproduce
The following entities are given:
Perform database migration and then execute the following to create new entities:
Expected behavior
I expected this code to not be executed if there is not an association on the other entity (maybe check if
$inverseAssoc
is null).I know I am doing something unusual, but should it still work?