use Pagerfanta\Pagerfanta;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
+use Wallabag\CoreBundle\Helper\UrlHasher;
class EntryRepository extends EntityRepository
{
public function findByUrlAndUserId($url, $userId)
{
return $this->findByHashedUrlAndUserId(
- hash('sha1', $url), // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls
- $userId);
+ UrlHasher::hashUrl($url),
+ $userId
+ );
}
/**
{
$res = $this->createQueryBuilder('e')
->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl)
+ // ->orWhere('e.givenUrl = :url')->setParameter('url', $url)
->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
->getQuery()
->getResult();