mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
refactor: move DQL in repositories
This commit is contained in:
@@ -17,7 +17,7 @@ class DomainStatusRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, DomainStatus::class);
|
||||
}
|
||||
|
||||
public function findNewDomainStatus(Domain $domain, \DateTimeImmutable $updatedAt)
|
||||
public function findNewDomainStatus(Domain $domain, \DateTimeImmutable $updatedAt): ?DomainStatus
|
||||
{
|
||||
return $this->createQueryBuilder('ds')
|
||||
->select()
|
||||
@@ -30,6 +30,18 @@ class DomainStatusRepository extends ServiceEntityRepository
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
|
||||
public function findLastDomainStatus(Domain $domain): ?DomainStatus
|
||||
{
|
||||
return $this->createQueryBuilder('ds')
|
||||
->select()
|
||||
->where('ds.domain = :domain')
|
||||
->setParameter('domain', $domain)
|
||||
->orderBy('ds.createdAt', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return DomainStatus[] Returns an array of DomainStatus objects
|
||||
// */
|
||||
|
||||
Reference in New Issue
Block a user