Issue with automatically disabling doctrine id generator #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So here's a failing test case for the problem described in #68.
I'll try it again in other words though:
Disabling the id generator automatically when loading fixtures is really super handy. It's always needed and really comfortable. I can just simply specify something like this and my
id
is not autogenerated even though I have an autogenerator registered for production:Now here's where it gets a bit tricky: If you have related entities with
cascade: persist
(which is very common I guess), disabling the id generator happens too late for some of the entities.Imagine this:
The way the fixture loader works is it persists every object one after the other. So it will persist
group_1
first and only thenuser_1
. Now if you do not havecascade: persist
configured, it works just fine. However, if you configuredcascade: persist
theid
foruser_1
is generated during->persist($group1)
already.So handling this in the
ObjectManagerPersister
does not work. Disabling the UUID generation has to be done before any of the objects is being persisted.So either we need a special loader (which I don't really like because loading is actually not affected) or we have to have a new interface a
Processor
can implement that is called before the persister is asked to persist any object.