diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
commit | f808b01692a835673f328d7221ba8c212caa9b61 (patch) | |
tree | 0c3b1fc5b1ddbd7af72227303503177689e1d403 /src/Wallabag/CoreBundle/Repository/EntryRepository.php | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
download | wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip |
Add a real configuration for CS-Fixer
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 9bda4e15..a65bfe3b 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -11,21 +11,6 @@ use Wallabag\CoreBundle\Entity\Tag; | |||
11 | class EntryRepository extends EntityRepository | 11 | class EntryRepository extends EntityRepository |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | * Return a query builder to used by other getBuilderFor* method. | ||
15 | * | ||
16 | * @param int $userId | ||
17 | * | ||
18 | * @return QueryBuilder | ||
19 | */ | ||
20 | private function getBuilderByUser($userId) | ||
21 | { | ||
22 | return $this->createQueryBuilder('e') | ||
23 | ->andWhere('e.user = :userId')->setParameter('userId', $userId) | ||
24 | ->orderBy('e.createdAt', 'desc') | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * Retrieves all entries for a user. | 14 | * Retrieves all entries for a user. |
30 | * | 15 | * |
31 | * @param int $userId | 16 | * @param int $userId |
@@ -108,7 +93,7 @@ class EntryRepository extends EntityRepository | |||
108 | 93 | ||
109 | // We lower() all parts here because PostgreSQL 'LIKE' verb is case-sensitive | 94 | // We lower() all parts here because PostgreSQL 'LIKE' verb is case-sensitive |
110 | $qb | 95 | $qb |
111 | ->andWhere('lower(e.content) LIKE lower(:term) OR lower(e.title) LIKE lower(:term) OR lower(e.url) LIKE lower(:term)')->setParameter('term', '%'.$term.'%') | 96 | ->andWhere('lower(e.content) LIKE lower(:term) OR lower(e.title) LIKE lower(:term) OR lower(e.url) LIKE lower(:term)')->setParameter('term', '%' . $term . '%') |
112 | ->leftJoin('e.tags', 't') | 97 | ->leftJoin('e.tags', 't') |
113 | ->groupBy('e.id'); | 98 | ->groupBy('e.id'); |
114 | 99 | ||
@@ -158,7 +143,7 @@ class EntryRepository extends EntityRepository | |||
158 | } | 143 | } |
159 | 144 | ||
160 | if (null !== $isPublic) { | 145 | if (null !== $isPublic) { |
161 | $qb->andWhere('e.uid IS '.(true === $isPublic ? 'NOT' : '').' NULL'); | 146 | $qb->andWhere('e.uid IS ' . (true === $isPublic ? 'NOT' : '') . ' NULL'); |
162 | } | 147 | } |
163 | 148 | ||
164 | if ($since > 0) { | 149 | if ($since > 0) { |
@@ -414,4 +399,19 @@ class EntryRepository extends EntityRepository | |||
414 | ->getQuery() | 399 | ->getQuery() |
415 | ->getResult(); | 400 | ->getResult(); |
416 | } | 401 | } |
402 | |||
403 | /** | ||
404 | * Return a query builder to used by other getBuilderFor* method. | ||
405 | * | ||
406 | * @param int $userId | ||
407 | * | ||
408 | * @return QueryBuilder | ||
409 | */ | ||
410 | private function getBuilderByUser($userId) | ||
411 | { | ||
412 | return $this->createQueryBuilder('e') | ||
413 | ->andWhere('e.user = :userId')->setParameter('userId', $userId) | ||
414 | ->orderBy('e.createdAt', 'desc') | ||
415 | ; | ||
416 | } | ||
417 | } | 417 | } |