mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
implement torrent locales form #11
This commit is contained in:
parent
6031ce59a2
commit
bf08fa6191
7 changed files with 544 additions and 243 deletions
|
|
@ -20,4 +20,37 @@ class TorrentLocalesRepository extends ServiceEntityRepository
|
|||
{
|
||||
parent::__construct($registry, TorrentLocales::class);
|
||||
}
|
||||
|
||||
public function getTorrentLocales(int $id): ?TorrentLocales
|
||||
{
|
||||
return $this->createQueryBuilder('tl')
|
||||
->where('tl.id = :id')
|
||||
->setParameter('id', $id)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findLastTorrentLocales(int $torrentId): ?TorrentLocales
|
||||
{
|
||||
return $this->createQueryBuilder('tl')
|
||||
->where('tl.torrentId = :torrentId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->orderBy('tl.id', 'DESC') // same to tl.added
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findTorrentLocales(int $torrentId): array
|
||||
{
|
||||
return $this->createQueryBuilder('tl')
|
||||
->where('tl.torrentId = :torrentId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->orderBy('tl.id', 'DESC') // same to tl.added
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue