mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Association doesn't work for an identifier with a custom name #5660
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 @automatix on GitHub (Aug 30, 2017).
Hello!
In my application there are entities
Foo,FooA extends Foo, andFooB extends Foo. They build a Single Table Inheritance structure.The
FooA#testXrefers (ManyToOne) the entityTextX:The
FooB#testBrefers (ManyToOne) the entityTextY:As you can see, the only difference is, that the entity
TestX' identifier isidand theTestY' identifier isname.Now I want to retrieve all
Fooentities and display the data:For the
FooTestXentities (and theTestXentities retrieved from them) the results are as exprected -- I get the data. But forTestYentities no data seems to be loaded. All their properties are empty and the identifier propertynamegets the value0. So when in the next step I try to get its data (e.g. with$loggedObject->getDescription();), it leads to an error, since Doctrine then tries to load a not existent entity withname0.For me it looks like a bug.
Or is it by design, that only entities with the identifierJust looked at another case in my code with aidcan be referenced in associations?ManyToOnereference to theTestYentity. There it's not in the context of the inheritance. And it works...Thanks
@Majkl578 commented on GitHub (Aug 30, 2017):
Can you please create a failing test case for this issue? PR with failing test would be helpful.
You can find some examples among the existing tests: https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket -- you can just copy one and adjust it to your needs.
@beberlei commented on GitHub (Dec 8, 2020):
Closed for missing tests, scenario too complex to recreate ourselves.