X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=f6f60c6fec2cab86ade3867033df0489ed7eff77;hb=46bbd8d321e6a00131f0e6ed96fa6f3d693b3678;hp=abf01930d1d9c6dc14a7176b9963df99bf6962e6;hpb=017e20895f6d731b2b8fd7cee0cd954eb7e96145;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index abf01930..f6f60c6f 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -2,7 +2,6 @@ namespace Wallabag\CoreBundle\Repository; -use Doctrine\ORM\Query; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Tools\Pagination\Paginator; @@ -25,7 +24,6 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isArchived = false') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->andWhere('e.isDeleted=false') ->orderBy('e.createdAt', 'desc') ->getQuery(); @@ -52,7 +50,6 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isArchived = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->andWhere('e.isDeleted=false') ->orderBy('e.createdAt', 'desc') ->getQuery(); @@ -79,7 +76,6 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isStarred = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->andWhere('e.isDeleted = false') ->orderBy('e.createdAt', 'desc') ->getQuery(); @@ -91,20 +87,18 @@ class EntryRepository extends EntityRepository /** * Find Entries * - * @param int $userId - * @param bool $isArchived - * @param bool $isStarred - * @param bool $isDeleted - * @param string $sort - * @param string $order + * @param int $userId + * @param bool $isArchived + * @param bool $isStarred + * @param string $sort + * @param string $order * * @return array */ - public function findEntries($userId, $isArchived = null, $isStarred = null, $isDeleted = null, $sort = 'created', $order = 'ASC') + public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC') { $qb = $this->createQueryBuilder('e') - ->leftJoin('e.user', 'u') - ->where('u.id =:userId')->setParameter('userId', $userId); + ->where('e.user =:userId')->setParameter('userId', $userId); if (null !== $isArchived) { $qb->andWhere('e.isArchived =:isArchived')->setParameter('isArchived', (bool) $isArchived); @@ -114,10 +108,6 @@ class EntryRepository extends EntityRepository $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); } - if (null !== $isDeleted) { - $qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', (bool) $isDeleted); - } - if ('created' === $sort) { $qb->orderBy('e.createdAt', $order); } elseif ('updated' === $sort) { @@ -128,4 +118,15 @@ class EntryRepository extends EntityRepository ->getQuery() ->getResult(); } + + public function findOneWithTags() + { + $qb = $this->createQueryBuilder('e') + ->innerJoin('e.tags', 't') + ->addSelect('t'); + + return $qb + ->getQuery() + ->getOneOrNullResult(); + } }