make common methods optimization

This commit is contained in:
ghost 2023-10-09 20:04:52 +03:00
parent 8d258c677b
commit 285a5104e2
10 changed files with 91 additions and 201 deletions

View file

@ -20,24 +20,4 @@ class TorrentRepository extends ServiceEntityRepository
{
parent::__construct($registry, Torrent::class);
}
public function getTorrent(int $id): ?Torrent
{
return $this->createQueryBuilder('t')
->where('t.id = :id')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult()
;
}
public function getTorrentScrapeQueue(): ?Torrent
{
return $this->createQueryBuilder('t')
->orderBy('t.scraped', 'ASC') // same to ts.added
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
}
}