mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2965: Error after changing IdGenerator to AssignedGenerator when for this entity class insert has been already executed #3692
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 (Feb 8, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user psliwa:
When you persist and flush entity and then change id generator to AssignedGenerator (and id generator type to NONE) for this entity class and then you persist and flush new entity with assigned id, below error will occur:
{quote}
Exception: [Doctrine\DBAL\Exception\DriverException] An exception occurred while executing 'INSERT INTO cms_emails (email) VALUES (?)' with params [13, "example@example.com"]:
SQLSTATE[HY000]: General error: 25 bind or column index out of range
{quote}
There is test that reproduces this issue:
The problem is in *BasicEntityPersister* because insertSql is cached and is not cleared after changing id generator. Binded parameters count doesn't match with insert query because there is new parameter: id.
@doctrinebot commented on GitHub (Feb 8, 2014):
flushmakes persisters unusable@doctrinebot commented on GitHub (Feb 9, 2014):
Comment created by @ocramius:
Provided a possible fix at https://github.com/doctrine/doctrine2/pull/942
@doctrinebot commented on GitHub (Feb 9, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-942] was closed:
https://github.com/doctrine/doctrine2/pull/942
@doctrinebot commented on GitHub (Feb 9, 2014):
Comment created by @beberlei:
It is not a supported use case to change metadata after loading them.
@doctrinebot commented on GitHub (Feb 9, 2014):
Issue was closed with resolution "Invalid"