From 1fcab6e6c6bd5dd496fbeda41dabb668e17e9ada Mon Sep 17 00:00:00 2001 From: anoy Date: Fri, 9 Oct 2020 19:08:30 +0200 Subject: fix multiple results for guid_hash Signed-off-by: anoy --- lib/Db/ItemMapperV2.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/Db') diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php index 54d9ecbaf..8bd939e71 100644 --- a/lib/Db/ItemMapperV2.php +++ b/lib/Db/ItemMapperV2.php @@ -99,6 +99,7 @@ class ItemMapperV2 extends NewsMapperV2 /** * Find an item by a GUID hash. * + * @param int $feedId ID of the feed * @param string $guidHash hash to find with * * @return Item|Entity @@ -106,12 +107,14 @@ class ItemMapperV2 extends NewsMapperV2 * @throws DoesNotExistException * @throws MultipleObjectsReturnedException */ - public function findByGuidHash(string $guidHash): Item + public function findByGuidHash(int $feedId, string $guidHash): Item { $builder = $this->db->getQueryBuilder(); $builder->addSelect('*') ->from($this->tableName) + ->andWhere('feed_id = :feed_id') ->andWhere('guid_hash = :guid_hash') + ->setParameter(':feed_id', $feedId, IQueryBuilder::PARAM_INT) ->setParameter(':guid_hash', $guidHash, IQueryBuilder::PARAM_STR); return $this->findEntity($builder); -- cgit v1.2.3