mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
@GeneratedValue(strategy="NONE") not working on @Id #5856
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 @masseelch on GitHub (Jan 24, 2018).
Originally assigned to: @Ocramius on GitHub.
I am trying to have my primary column NOT getting assigned the
auto_incrementoption by doctrine.Following the docs i used the following approach:
Doctrine does ignore this and will always attempt to change the Column:

When trying to insert a new record, i cannot set the ID and always get
since doctrine does not take my code-generated Id but tries to use the database value (which does not provide one, since
auto_incrementis not set).@Ocramius commented on GitHub (Jan 26, 2018):
This needs a test case to be reproduced.
@zeleniy commented on GitHub (Sep 3, 2019):
Any success??
@Ocramius commented on GitHub (Sep 3, 2019):
Closing here: please open a new issue once a test case reproducing the issue is available.
@Tagirijus commented on GitHub (Jun 20, 2021):
I have a similar issue, when trying to use
NONEas the ID strategy. The thing on my end was: I had a loop with which I import multiple entries. And inside the loop I only did apersist()for the entity. When I change this topersist()andflush()(inside the loop) it works here.I think that it might be that otherwise only persisted entites with manually set IDs could become a problem, when another entity during the import (without flushing in the meantime) gets persisted as well ...
Info: I am totally new to doctrine ... so maybe I do not understand something else here in general, but again: it works for me when just flushing one entity directly on my import method.
Maybe this might help somebody in the future. (-;