Skip to content

Commit

Permalink
document transactional() behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed May 5, 2022
1 parent 006f227 commit a778377
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/en/reference/transactions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ is functionally equivalent to the previous one:
// do stuff
});

Note that the closure above doesn't have to be a void, anything it
returns will be returned by ``transactional()``:

::

<?php
$one = $conn->transactional(function(Connection $conn): int {
// do stuff
return $conn->fetchOne('SELECT 1');
});


The ``Doctrine\DBAL\Connection`` class also has methods to control the
transaction isolation level as supported by the underlying
database. ``Connection#setTransactionIsolation($level)`` and
Expand Down

0 comments on commit a778377

Please sign in to comment.