mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Doctrine Mapping Issue: "default" Value Overwrites "name" Attribute Value in Certain Cases. #7128
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 @oto-emo on GitHub (Mar 31, 2023).
Hi everyone!
I've been coding on Symfony (and Doctrine) since 2016 and I've come across an issue that doesn't seem to be caused by my code, maybe it's related to Doctrine.
I've noticed a problem that's a bit difficult to understand (especially to explain), and it took me a while to identify its source. I feel like the use of certain terms (column names and/or class properties) is causing the problem.
Here's the problem: I have three entities with the following relationships:
Fund -> OneToMany -> FundBenchmark
Benchmark -> OneToMany -> FundBenchmark
FundBenchmark is the relational table, carrying additional attributes for Fund and Benchmark.
In FundBenchmark, I have:
And in Benchmark:
Now, this is where things get tricky to explain. I have two benchmarks with different names, but they are linked to the same Fund and have different ranks.
Benchmark:
They are linked to the same Fund but have different ranks.
FundBenchmark:
What I've noticed is that in this state, I retrieve both rows correctly, but the name field of the benchmark with rank bench2 is overwritten by the name of the benchmark with rank default. All other values are correct. If I modify the value of the default rank in the database to something else, the name field has the correct value present in the database.
I suspect that the value "default" and the property name "name" together are disrupting the proper retrieval of the expected "name" value.
Specifications :
@oto-emo commented on GitHub (Apr 3, 2023):
A "simple" memory problem that was overwriting my previously loaded attributes.