mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
implement torrent search features
This commit is contained in:
parent
e9375f9127
commit
8ab4c0b9cf
7 changed files with 293 additions and 12 deletions
|
|
@ -20,4 +20,21 @@ class TorrentRepository extends ServiceEntityRepository
|
|||
{
|
||||
parent::__construct($registry, Torrent::class);
|
||||
}
|
||||
|
||||
public function searchByKeywords(
|
||||
array $keywords
|
||||
): ?array
|
||||
{
|
||||
$query = $this->createQueryBuilder('t');
|
||||
|
||||
foreach ($keywords as $keyword)
|
||||
{
|
||||
$query->orWhere('t.keywords LIKE :query')
|
||||
->setParameter('query', "%{$keyword}%");
|
||||
}
|
||||
|
||||
return $query->orderBy('t.id', 'ASC') // same as t.added
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue