mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
make common methods optimization
This commit is contained in:
parent
8d258c677b
commit
285a5104e2
10 changed files with 91 additions and 201 deletions
|
|
@ -20,37 +20,4 @@ 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 findLastTorrentLocalesByTorrentId(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 findTorrentLocalesByTorrentId(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