database icon indicating copy to clipboard operation
database copied to clipboard

Connection: added inTransaction()

Open pavolbiely opened this issue 6 years ago • 3 comments

A new inTransaction() method might be a very useful shortcut.

Calling is unnecessary long right now.

/* @var \Nette\Database\Connection $db */
if ($db->getPdo()->inTransaction()) {
   $db->rollBack();
}

Why not just use it like this?

/* @var \Nette\Database\Connection $db */
if ($db->inTransaction()) {
   $db->rollBack();
}

Other shortcuts like beginTransaction(), commit() and rollback() are already implemented in Connection class.

pavolbiely avatar Feb 20 '19 21:02 pavolbiely

Is there something wrong with the implementation? I could help but got no response.

pavolbiely avatar Apr 02 '19 13:04 pavolbiely

@dg What do you think?

EdaCZ avatar Jul 26 '19 20:07 EdaCZ

Please can you add simple test?

dg avatar Aug 05 '19 10:08 dg