refactor: move logic in RDAPService

This commit is contained in:
Maël Gangloff
2025-10-22 15:24:29 +02:00
parent 9f71013c8e
commit 24e1c1533c
4 changed files with 133 additions and 120 deletions

View File

@@ -17,17 +17,18 @@ class DomainEventRepository extends ServiceEntityRepository
parent::__construct($registry, DomainEvent::class);
}
public function findLastExpirationDomainEvent(Domain $domain)
public function findLastDomainEvent(Domain $domain, string $action)
{
return $this->createQueryBuilder('de')
->select()
->where('de.domain = :domain')
->andWhere('de.action = \'expiration\'')
->andWhere('de.action = :action')
->andWhere('de.deleted = FALSE')
->orderBy('de.date', 'DESC')
->setMaxResults(1)
->getQuery()
->setParameter('domain', $domain)
->setParameter('action', $action)
->getOneOrNullResult();
}