Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/guide/application/units-of-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions docs/guide/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/Contracts/Application/Ports/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading