diff --git a/docs/en/reference/transactions-and-concurrency.rst b/docs/en/reference/transactions-and-concurrency.rst index 9e477474280..afcbb216bce 100644 --- a/docs/en/reference/transactions-and-concurrency.rst +++ b/docs/en/reference/transactions-and-concurrency.rst @@ -88,7 +88,7 @@ requirement. A more convenient alternative for explicit transaction demarcation is the use of provided control abstractions in the form of -``Connection#transactional($func)`` and ``EntityManager#transactional($func)``. +``Connection#transactional($func)`` and ``EntityManager#wrapInTransaction($func)``. When used, these control abstractions ensure that you never forget to rollback the transaction, in addition to the obvious code reduction. An example that is functionally equivalent to the previously shown code looks as follows: @@ -96,21 +96,23 @@ functionally equivalent to the previously shown code looks as follows: .. code-block:: php transactional(function($conn) { + // ... do some work + $user = new User; + $user->setName('George'); + }); + + // transactional with EntityManager instance // $em instanceof EntityManager - $em->transactional(function($em) { + $em->wrapInTransaction(function($em) { // ... do some work $user = new User; $user->setName('George'); $em->persist($user); }); -.. warning:: - - For historical reasons, ``EntityManager#transactional($func)`` will return - ``true`` whenever the return value of ``$func`` is loosely false. - Some examples of this include ``array()``, ``"0"``, ``""``, ``0``, and - ``null``. - The difference between ``Connection#transactional($func)`` and ``EntityManager#transactional($func)`` is that the latter abstraction flushes the ``EntityManager`` prior to transaction