1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00

Added translations and currentRoute parameter

This commit is contained in:
Nicolas Lœuillet 2016-11-10 15:23:53 +01:00
parent 398de40517
commit 49b042dfdf
15 changed files with 57 additions and 8 deletions

View file

@ -90,18 +90,30 @@ class EntryRepository extends EntityRepository
*
* @param int $userId
* @param string $term
* @param strint $currentRoute
*
* @return QueryBuilder
*/
public function getBuilderForSearchByUser($userId, $term)
public function getBuilderForSearchByUser($userId, $term, $currentRoute)
{
return $this
->getBuilderByUser($userId)
->andWhere('e.content LIKE :term')->setParameter('term', '%'.$term.'%')
->orWhere('e.title LIKE :term')->setParameter('term', '%'.$term.'%')
$qb = $this
->getBuilderByUser($userId);
if ('starred' === $currentRoute) {
$qb->andWhere('e.isStarred = true');
} elseif ('unread' === $currentRoute) {
$qb->andWhere('e.isArchived = false');
} elseif ('archive' === $currentRoute) {
$qb->andWhere('e.isArchived = true');
}
$qb
->andWhere('e.content LIKE :term OR e.title LIKE :term')->setParameter('term', '%'.$term.'%')
->leftJoin('e.tags', 't')
->groupBy('e.id')
->having('count(t.id) = 0');
return $qb;
}
/**