-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postpersist doesn't work for the 2nd time #292
Comments
@kbond I've seen that ticket as well. I don't think that it's the same problem. I tried that I booted Foundry with fromContainer and withConfiguration , but then I received an error like this:
The UserFactory has a dependency. |
I'm sort of thinking that somehow the object is still managed by doctrine in the second scenario, so when it tries to save, it see's it's already there (even though it's not). Before creating the entity in the second scenario, can you try clearing the em? |
Hm, accidentally I left the I think the ticket can be closed, but in any case, it's interesting; the DB is in sync with the changes from postPersist as well. |
I use the bundle together with Behat. Behat has a
beforeScenario
step, to purge the DB.I have for the given entity - for example
User
- post persist calculation and the postPersist contains a flush as well. For Foundry, Autofersh is set totrue
by default.I create it like this for the user:
If I have 2 Behat scenario, for the first test, everything goes though without a problem, the
flush
goes through from the postPersist, but for the second scenario, it doesn't, so I had to calldisableAutoRefresh
after I created a new User with a factory.I have nothing special set up for Foundry, just the default setting.
The problem comes, that in the
function object()
it checks, if there is something in the changeset, which is not yet saved. Eventghoug for the second run, the changes are there from thepostPersist
- not saved into the DB, even though the flush is in the code - if I call a$user->save()
nothing is saved actually.I can solve things also by disabling the listener, but the perfect solution would be, if they could run correctly and always, not just for the first Scenario.
The text was updated successfully, but these errors were encountered: