File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,11 @@ class SetTransactionIsolationLevel implements EventSubscriber {
3939 */
4040 public function postConnect (ConnectionEventArgs $ args ) {
4141 $ connection = $ args ->getConnection ();
42- $ connection ->setTransactionIsolation (TransactionIsolationLevel::READ_COMMITTED );
43- if ($ connection ->getDatabasePlatform () instanceof MySQLPlatform) {
44- $ connection ->executeStatement ('SET SESSION AUTOCOMMIT=1 ' );
42+ if ($ connection instanceof PrimaryReadReplicaConnection && $ connection ->isConnectedToPrimary ()) {
43+ $ connection ->setTransactionIsolation (TransactionIsolationLevel::READ_COMMITTED );
44+ if ($ connection ->getDatabasePlatform () instanceof MySQLPlatform) {
45+ $ connection ->executeStatement ('SET SESSION AUTOCOMMIT=1 ' );
46+ }
4547 }
4648 }
4749
You can’t perform that action at this time.
0 commit comments