mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-4005: Persist incorrectly insert data to identity map #4890
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 @doctrinebot on GitHub (Nov 19, 2015).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user pk16011990:
ArticleAttribute has a composite primary key that contains association to Article that has generated primary key.
The example tries to persist ArticleAttribute without persisting and flushing Article first. Article does not have primary key yet and therefore when ArticleAttribute has incomplete primary key. The bad thing is that Doctrine instead of throwing exception inserts both ArticleAttribute entities into identity map under same hash (because AssignedGenerator created a hash containing NULL instead of Article's ID).
Doctrine\ORM\Id\AssignedGeneratorreturns same identifier for two diferent instances of ArticleAttribute.Notice that $value in
a67332fb51/lib/Doctrine/ORM/Id/AssignedGenerator.php (L58)can be NULL and therefore generated ID can contain NULL.I would appreciate if Doctrine threw an exception in such situation instead of behaving as if everything was OK.
@boris-brtan commented on GitHub (Aug 20, 2018):
Hi,
what is the status of this bug, is it somehow solved?
@Ocramius commented on GitHub (Aug 20, 2018):
Closing: requires a test case which is missing.
@boris-brtan commented on GitHub (Nov 15, 2018):
THX, we found some way by creating new packagist repo