mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
draft torrent sensitive features
This commit is contained in:
parent
6fbce1678d
commit
5aa20e6a22
2 changed files with 49 additions and 0 deletions
|
|
@ -20,4 +20,37 @@ class TorrentSensitiveRepository extends ServiceEntityRepository
|
|||
{
|
||||
parent::__construct($registry, TorrentSensitive::class);
|
||||
}
|
||||
|
||||
public function getTorrentSensitive(int $id): ?TorrentSensitive
|
||||
{
|
||||
return $this->createQueryBuilder('ts')
|
||||
->where('ts.id = :id')
|
||||
->setParameter('id', $id)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findLastTorrentSensitive(int $torrentId): ?TorrentSensitive
|
||||
{
|
||||
return $this->createQueryBuilder('ts')
|
||||
->where('ts.torrentId = :torrentId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->orderBy('ts.id', 'DESC') // same to ts.added
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findTorrentSensitive(int $torrentId): array
|
||||
{
|
||||
return $this->createQueryBuilder('ts')
|
||||
->where('ts.torrentId = :torrentId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->orderBy('ts.id', 'DESC') // same to ts.added
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue