jebbench
jebbench

Reputation: 313

Concurrent connections to the same DB in Doctrine 2 using Symfony 2.1

I have a script that does some heavy processing (it's run from the command line).

This script uses a transaction to ensure that it either completes successfully or leaves the database untouched if it fails.

This script also logs to the same database; the logs need to be real time (for displaying on a website so users can see the progress) so they can't be collected and then persisted after the data has processed and the transaction is committed (or rolled back).

So my question is: how do I get two entity managers for the same database in Symfony 2.1?

I'm working on the assumption that I need two connections to the database to allow me to put each of the logging insert statements in its own transaction and have the data processing in another transaction.

Thanks for any help. James Bench

Upvotes: 0

Views: 820

Answers (1)

You can create subtasks in that script one for writing the data to the data base and another for logging. You can use The Process Component.

Upvotes: 1

Related Questions