From 68cb3665852c7787f0e28edd6c916c2f02c04c8e Mon Sep 17 00:00:00 2001 From: vinceh121 Date: Mon, 20 Oct 2025 22:37:11 +0200 Subject: [PATCH] fix: domain event refresh working one every two times --- src/Controller/WatchListController.php | 2 +- src/Service/RDAPService.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controller/WatchListController.php b/src/Controller/WatchListController.php index 686e021..f363f8a 100644 --- a/src/Controller/WatchListController.php +++ b/src/Controller/WatchListController.php @@ -115,10 +115,10 @@ class WatchListController extends AbstractController ->where('de.domain = :domain') ->andWhere('de.action = \'expiration\'') ->andWhere('de.deleted = FALSE') - ->setParameter('domain', $domain) ->orderBy('de.date', 'DESC') ->setMaxResults(1) ->getQuery() + ->setParameter('domain', $domain) ->getOneOrNullResult(); if (!$domain->getDeleted() && null !== $exp && !in_array($domain, $domains)) { diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index 49872ef..95b663e 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -378,6 +378,10 @@ class RDAPService if (null === $event) { $event = new DomainEvent(); + } else { + // at this point Doctrine doesn't know that the events are + // deleted in the database, so refresh in order to make the diff work + $this->em->refresh($event); } $domain->addEvent($event