File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,9 @@ public function withTransaction(callable $callback): mixed
125125
126126 public function startTransaction (): bool
127127 {
128-
129128 // If the database is not a replica set, we can't use transactions
130129 if (!$ this ->client ->isReplicaSet ()) {
131- return false ;
130+ return true ;
132131 }
133132
134133 try {
@@ -162,6 +161,11 @@ public function startTransaction(): bool
162161
163162 public function commitTransaction (): bool
164163 {
164+ // If the database is not a replica set, we can't use transactions
165+ if (!$ this ->client ->isReplicaSet ()) {
166+ return true ;
167+ }
168+
165169 try {
166170 if ($ this ->inTransaction === 0 ) {
167171 return false ;
@@ -194,6 +198,11 @@ public function commitTransaction(): bool
194198
195199 public function rollbackTransaction (): bool
196200 {
201+ // If the database is not a replica set, we can't use transactions
202+ if (!$ this ->client ->isReplicaSet ()) {
203+ return true ;
204+ }
205+
197206 try {
198207 if ($ this ->inTransaction === 0 ) {
199208 return false ;
You can’t perform that action at this time.
0 commit comments