Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with single table inheritance and association keys #11611

Draft
wants to merge 1 commit into
base: 3.2.x
Choose a base branch
from

Conversation

DavideBicego
Copy link
Contributor

@DavideBicego DavideBicego commented Sep 25, 2024

Having a one to one join with a single table inheritance entity i have issues when the proxy __load results in not having an associated tuple in the joined table.
The given exception is:

Doctrine\ORM\Exception\EntityIdentityCollisionException: While adding an entity of class KanbanBOX\Core\Card\Domain\Model\CardVersion with an ID hash of "256" to the identity map,
another object of class DoctrineProxies\__CG__\KanbanBOX\Core\Card\Domain\Model\CardVersion was already present for the same ID. This exception
is a safeguard against an internal inconsistency - IDs should uniquely map to
entity object instances. This problem may occur if:

- you use application-provided IDs and reuse ID values;
- database-provided IDs are reassigned after truncating the database without
clearing the EntityManager;
- you might have been using EntityManager#getReference() to create a reference
for a nonexistent ID that was subsequently (by the RDBMS) assigned to another
entity.

Otherwise, it might be an ORM-internal inconsistency, please report it.

I'm having problems simulating my issue in Doctrine/ORM testing environment since the test is creating a FOREIGN KEY based on mapping that makes the test fail.
In our real scenario we have a database first approach so we don't really have foreign key constraints.

@DavideBicego DavideBicego changed the title Adds testing to simulate the issue Issue with single table inheritance and association keys Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant