diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/ChangeRepository.php | 26 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 14 |
2 files changed, 39 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/ChangeRepository.php b/src/Wallabag/CoreBundle/Repository/ChangeRepository.php new file mode 100644 index 00000000..18d015a7 --- /dev/null +++ b/src/Wallabag/CoreBundle/Repository/ChangeRepository.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Repository; | ||
4 | |||
5 | use Doctrine\ORM\EntityRepository; | ||
6 | |||
7 | class ChangeRepository extends EntityRepository | ||
8 | { | ||
9 | /** | ||
10 | * Used only in test case to get a tag for our entry. | ||
11 | * | ||
12 | * @param int $timestamp | ||
13 | * | ||
14 | * @return Tag | ||
15 | */ | ||
16 | public function findChangesSinceDate($timestamp) | ||
17 | { | ||
18 | $date = new \DateTime(); | ||
19 | $date->setTimestamp($timestamp); | ||
20 | |||
21 | return $this->createQueryBuilder('c') | ||
22 | ->where('c.createdAt >= :timestamp')->setParameter('timestamp', $date) | ||
23 | ->getQuery() | ||
24 | ->getResult(); | ||
25 | } | ||
26 | } | ||
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 9bda4e15..4bbd05ff 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Repository; | |||
4 | 4 | ||
5 | use Doctrine\ORM\EntityRepository; | 5 | use Doctrine\ORM\EntityRepository; |
6 | use Doctrine\ORM\Query; | 6 | use Doctrine\ORM\Query; |
7 | use Doctrine\ORM\QueryBuilder; | ||
7 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 8 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
8 | use Pagerfanta\Pagerfanta; | 9 | use Pagerfanta\Pagerfanta; |
9 | use Wallabag\CoreBundle\Entity\Tag; | 10 | use Wallabag\CoreBundle\Entity\Tag; |
@@ -89,7 +90,7 @@ class EntryRepository extends EntityRepository | |||
89 | * | 90 | * |
90 | * @param int $userId | 91 | * @param int $userId |
91 | * @param string $term | 92 | * @param string $term |
92 | * @param strint $currentRoute | 93 | * @param string $currentRoute |
93 | * | 94 | * |
94 | * @return QueryBuilder | 95 | * @return QueryBuilder |
95 | */ | 96 | */ |
@@ -414,4 +415,15 @@ class EntryRepository extends EntityRepository | |||
414 | ->getQuery() | 415 | ->getQuery() |
415 | ->getResult(); | 416 | ->getResult(); |
416 | } | 417 | } |
418 | |||
419 | /** | ||
420 | * @param $userId | ||
421 | * @return QueryBuilder | ||
422 | */ | ||
423 | public function getBuilderForRecommendationsByUser($userId) | ||
424 | { | ||
425 | return $this->getBuilderByUser($userId) | ||
426 | ->andWhere('e.recommended = true') | ||
427 | ; | ||
428 | } | ||
417 | } | 429 | } |