Closed akserikawa closed 1 year ago
Also see https://github.com/dmaicher/doctrine-test-bundle/issues/66
Currently this bundle requires everything to be run in the same php process so that the same PDO instance is used and the transaction logic works.
Wondering why you need to edit the entity in a different php process?
Thanks for the fast answer! Actually my use case is a bit more complicated than the example I provided. I'm creating/editing a long list of entities at once and I need to run parallel processes due to performance issues. Because the editing part involves updating the actual entity + sending messages to different queues via AMQP.
From #66 I tried setting StaticDriver::setKeepStaticConnections(true);
in my test case without success.
There is no way to solve this ATM then?
There is no way to solve this ATM then?
Yeah as of now this is impossible.
I would maybe instead look into solving those performance issues? Do you run your tests in "no-debug" mode for the Symfony kernel?
Doing this in sub-processes seems very exotic :blush:
Sadly I currently don't have an option other than running parallel processes. Updating thousands of records at once every minute and having to serialize each record and publish it to different queues via 3rd party API (each message takes ~140ms) would take more time than the mandatory minute timeframe.
Doing this in sub-processes seems very exotic blush
I agree, exotic solution for a bit exotic use case. And PHP does not help much here either :')
I'm now considering not using this bundle for this test case in particular and let the test case persist the data to the DB. I'll have to clean up all records manually after that.
Thanks for your time though. Have a good day!
I'm now considering not using this bundle for this test case in particular and let the test case persist the data to the DB. I'll have to clean up all records manually after that.
Yeah then this is the only way currently indeed
Closing as its the same issue as https://github.com/dmaicher/doctrine-test-bundle/issues/66
Is there a way to share DB state between PHP main and sub-processes?
Currently, the class I want to test does something like this:
I would like to test that the result in DB matches what I expect once both steps finish.
Problem is the sub-process cannot retrieve the entity created in the main one.
ps: Note the sub-processes run asynchronously.
Any ideas on how to solve this? Is there a way to retrieve the changes in the entity?