aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-05-05 17:42:18 +0200
committerGitHub <noreply@github.com>2017-05-05 17:42:18 +0200
commitab742ee9c69f8cf6e6295d6044e05accffc5551d (patch)
tree503f54518cd9df45434903714eff2a5ab71c8a7c /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parent69803049688179e1b03ef424dec91f1b9a4f9e91 (diff)
parent4eeb29ff784934fa879dd87999e07c4c7626af8c (diff)
downloadwallabag-ab742ee9c69f8cf6e6295d6044e05accffc5551d.tar.gz
wallabag-ab742ee9c69f8cf6e6295d6044e05accffc5551d.tar.zst
wallabag-ab742ee9c69f8cf6e6295d6044e05accffc5551d.zip
Merge pull request #2920 from wallabag/cleanduplicatescommand
Clean Duplicates Command
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 1f22e901..6972e974 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -379,4 +379,34 @@ class EntryRepository extends EntityRepository
379 ->setParameter('userId', $userId) 379 ->setParameter('userId', $userId)
380 ->execute(); 380 ->execute();
381 } 381 }
382
383 /**
384 * Get id and url from all entries
385 * Used for the clean-duplicates command.
386 */
387 public function getAllEntriesIdAndUrl($userId)
388 {
389 $qb = $this->createQueryBuilder('e')
390 ->select('e.id, e.url')
391 ->where('e.user = :userid')->setParameter(':userid', $userId);
392
393 return $qb->getQuery()->getArrayResult();
394 }
395
396 /**
397 * Find all entries by url and owner.
398 *
399 * @param $url
400 * @param $userId
401 *
402 * @return array
403 */
404 public function findAllByUrlAndUserId($url, $userId)
405 {
406 return $this->createQueryBuilder('e')
407 ->where('e.url = :url')->setParameter('url', urldecode($url))
408 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
409 ->getQuery()
410 ->getResult();
411 }
382} 412}