Delegate findByUrlAndUserId to findByHashedUrlAndUserId

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2019-05-03 22:23:04 +10:00 committed by Jeremy Benoist
parent 31e276fc16
commit d5744bf0df
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C

View file

@ -348,17 +348,9 @@ class EntryRepository extends EntityRepository
*/
public function findByUrlAndUserId($url, $userId)
{
$res = $this->createQueryBuilder('e')
->where('e.url = :url')->setParameter('url', urldecode($url))
->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
->getQuery()
->getResult();
if (\count($res)) {
return current($res);
}
return false;
return $this->findByHashedUrlAndUserId(
hash('sha1', $url), // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls
$userId);
}
/**