diff --git a/docs/guide/application/units-of-work.md b/docs/guide/application/units-of-work.md index 65ecbe6..bddc3af 100644 --- a/docs/guide/application/units-of-work.md +++ b/docs/guide/application/units-of-work.md @@ -171,8 +171,9 @@ interface UnitOfWork /** * Is a unit of work currently active? * - * Returns true while a callback passed to `execute()` is running, i.e. there is an open transaction that will be - * committed or rolled back once the callback completes. + * Returns true when there is an open transaction that work will be committed or rolled back with, e.g. while a + * callback passed to `execute()` is running. Implementations MAY also return true for a transaction that was not + * started by this unit of work, if they cannot distinguish it. */ public function active(): bool; diff --git a/docs/guide/upgrade.md b/docs/guide/upgrade.md index e20df9b..912486f 100644 --- a/docs/guide/upgrade.md +++ b/docs/guide/upgrade.md @@ -11,8 +11,10 @@ composer require cloudcreativity/ddd-modules:^7.0 ### Unit of Work The `UnitOfWork` driven port now has `active()` and `inactive()` methods. These indicate whether a unit of work is -currently in progress - i.e. whether the callback passed to `execute()` is running. You will need to add these methods -to your unit of work adapter. For example, a Laravel adapter could implement them as follows: +currently in progress - i.e. whether there is an open transaction that work will be committed or rolled back with, +such as while the callback passed to `execute()` is running. Implementations may also report a transaction that was not +started by the unit of work as active, if they cannot distinguish it. You will need to add these methods to your unit +of work adapter. For example, a Laravel adapter could implement them as follows: ```php public function active(): bool diff --git a/src/Contracts/Application/Ports/UnitOfWork.php b/src/Contracts/Application/Ports/UnitOfWork.php index efd804d..3ce2b08 100644 --- a/src/Contracts/Application/Ports/UnitOfWork.php +++ b/src/Contracts/Application/Ports/UnitOfWork.php @@ -19,8 +19,9 @@ interface UnitOfWork /** * Is a unit of work currently active? * - * Returns true while a callback passed to `execute()` is running, i.e. there is an open transaction that will be - * committed or rolled back once the callback completes. + * Returns true when there is an open transaction that work will be committed or rolled back with, e.g. while a + * callback passed to `execute()` is running. Implementations MAY also return true for a transaction that was not + * started by this unit of work, if they cannot distinguish it. */ public function active(): bool;