My code:
$connection->beginTransaction(); $row = $this->newQuery()->where(['someField' => 'someValue'])->lockForUpdate()->get()->first(); if (is_null($row)) { $connection->rollBack(); return null; } //do some stuff with that row $connection->commit();
My question: The result is empty, so do I need that rollback? Should I commit? Is transaction still opened by that point?
2.1m questions
2.1m answers
60 comments
57.0k users