My entity uses this annotation for it\'s ID:
/**
* @orm:Id
* @orm:Column(type=\"integer\")
* @orm:GeneratedValue(s
Inspired by Villermen work, I created the library tseho/doctrine-assigned-identity which allows you to manually assign IDs to a Doctrine entity, even when the entity uses the stategies AUTO, SEQUENCE, IDENTITY or UUID.
You should never use it in production but it's really useful for functional tests.
The library will detect automatically the entities with an assigned id and replace the generator only when needed. The library will fallback on the initial generator when an instance does not have an assigned id.
The replacement of the generator occurs in a Doctrine EventListener, no need to add any additional code in your fixtures.