From f74cfaee22298f38bb8d3a19b561cf842b2ab45d Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Mon, 24 Nov 2025 11:08:35 +0400 Subject: [PATCH] fix: Sequential persist with OptimisticLock: use state transaction data instead of node data --- src/Listener/OptimisticLock.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Listener/OptimisticLock.php b/src/Listener/OptimisticLock.php index d4ab6f8..be757e7 100644 --- a/src/Listener/OptimisticLock.php +++ b/src/Listener/OptimisticLock.php @@ -80,10 +80,9 @@ public function __invoke(OnDelete|OnUpdate $event): void private function lock(Node $node, State $state, ScopeCarrierInterface $command): WrappedStoreCommand { - $nodeValue = $node->getData()[$this->field] ?? null; - if ($nodeValue === null) { - throw new OptimisticLockException(\sprintf('The `%s` field is not set.', $this->field)); - } + $nodeValue = $state->getTransactionData()[$this->field] ?? throw new OptimisticLockException( + \sprintf('The field %s.%s is not set.', $node->getRole(), $this->field), + ); // Process known rule if ($this->isKnownRule) {