From 0a49274f9b92426e17dd4a5fdf3aae41dd24c59f Mon Sep 17 00:00:00 2001 From: d-ph <4347095+d-ph@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:36:42 +0000 Subject: [PATCH] Update aggregate-fields.rst Change `PESSIMISTIC_READ` to `PESSIMISTIC_WRITE`. Otherwise, the solution to the race condition at the bottom of the article would allow concurrent reads, which would not solve the presented race condition problem. --- docs/en/cookbook/aggregate-fields.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/cookbook/aggregate-fields.rst b/docs/en/cookbook/aggregate-fields.rst index 001d70d34b4..20bfa32896f 100644 --- a/docs/en/cookbook/aggregate-fields.rst +++ b/docs/en/cookbook/aggregate-fields.rst @@ -352,7 +352,7 @@ the database using a FOR UPDATE. use Bank\Entities\Account; use Doctrine\DBAL\LockMode; - $account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_READ); + $account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_WRITE); Keeping Updates and Deletes in Sync -----------------------------------