From 3323e50db15f93cf6a97860325df472c662e82e7 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 19 Jan 2024 09:58:28 +0100 Subject: [PATCH] Address code review items --- lib/Doctrine/ODM/MongoDB/UnitOfWork.php | 3 +++ lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php index aefa8c5ff..b25ea58eb 100644 --- a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php +++ b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php @@ -3183,6 +3183,9 @@ private function getTransactionOptions(array $options): array /** * This following method was taken from the MongoDB Library and adapted to not use the default 120 seconds timeout. * The code within this method is licensed under the Apache License. Copyright belongs to MongoDB, Inc. + * + * @see https://github.com/mongodb/mongo-php-library/blob/1.17.0/src/Operation/WithTransaction.php + * @see https://github.com/mongodb/specifications/blob/master/source/transactions-convenient-api/transactions-convenient-api.rst#pseudo-code */ private function withTransaction(Session $session, callable $callback, array $transactionOptions = []): void { diff --git a/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php b/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php index c6319fc2b..a44ff8f25 100644 --- a/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php +++ b/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php @@ -188,8 +188,8 @@ public function preUpdate(ClassMetadata $class, object $document, ?Session $sess return; } - $eventArgs = new PreUpdateEventArgs($document, $this->dm, $this->uow->getDocumentChangeSet($document), $session); if (! empty($class->lifecycleCallbacks[Events::preUpdate])) { + $eventArgs = new PreUpdateEventArgs($document, $this->dm, $this->uow->getDocumentChangeSet($document), $session); $class->invokeLifecycleCallbacks(Events::preUpdate, $document, [$eventArgs]); $this->uow->recomputeSingleDocumentChangeSet($class, $document); }