mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 09:35:28 +00:00
make common methods optimization
This commit is contained in:
parent
8d258c677b
commit
285a5104e2
10 changed files with 91 additions and 201 deletions
|
|
@ -21,23 +21,6 @@ class TorrentDownloadMagnetRepository extends ServiceEntityRepository
|
|||
parent::__construct($registry, TorrentDownloadMagnet::class);
|
||||
}
|
||||
|
||||
public function findTorrentDownloadMagnet(
|
||||
int $torrentId,
|
||||
int $userId
|
||||
): ?TorrentDownloadMagnet
|
||||
{
|
||||
return $this->createQueryBuilder('tdm')
|
||||
->where('tdm.torrentId = :torrentId')
|
||||
->andWhere('tdm.userId = :userId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->setParameter('userId', $userId)
|
||||
->orderBy('tdm.id', 'DESC') // same to ts.added
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findTorrentDownloadMagnetsTotalByTorrentId(
|
||||
int $torrentId
|
||||
): int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue