mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
implement bookmarks total counter
This commit is contained in:
parent
3d74818303
commit
5b0a7bcb69
5 changed files with 62 additions and 52 deletions
|
|
@ -21,7 +21,7 @@ class TorrentBookmarkRepository extends ServiceEntityRepository
|
|||
parent::__construct($registry, TorrentBookmark::class);
|
||||
}
|
||||
|
||||
public function findUserLastTorrentBookmark(
|
||||
public function findTorrentBookmark(
|
||||
int $torrentId,
|
||||
int $userId
|
||||
): ?TorrentBookmark
|
||||
|
|
@ -37,4 +37,17 @@ class TorrentBookmarkRepository extends ServiceEntityRepository
|
|||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findTorrentBookmarksTotalByTorrentId(
|
||||
int $torrentId
|
||||
): int
|
||||
{
|
||||
return $this->createQueryBuilder('tb')
|
||||
->select('count(tb.id)')
|
||||
->where('tb.torrentId = :torrentId')
|
||||
->setParameter('torrentId', $torrentId)
|
||||
->getQuery()
|
||||
->getSingleScalarResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue