File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,7 @@ public function findOneByFilenames(array $fileNames): ?DocumentInterface
34
34
35
35
public function findOneByHashAndAlgorithm (string $ hash , string $ algorithm ): ?DocumentInterface
36
36
{
37
- return $ this ->getRepository ()->findOneBy ([
38
- 'fileHash ' => $ hash ,
39
- 'fileHashAlgorithm ' => $ algorithm ,
40
- ]);
37
+ return $ this ->getRepository ()->findOneByHashAndAlgorithm ($ hash , $ algorithm );
41
38
}
42
39
43
40
protected function getRepository (): DocumentRepository
Original file line number Diff line number Diff line change @@ -365,6 +365,18 @@ protected function getContextualQueryWithTranslation(
365
365
return $ qb ;
366
366
}
367
367
368
+ public function findOneByHashAndAlgorithm (string $ hash , string $ hashAlgorithm ): ?Document
369
+ {
370
+ $ qb = $ this ->createQueryBuilder ('d ' );
371
+ $ qb ->andWhere ($ qb ->expr ()->eq ('d.fileHash ' , ':hash ' ))
372
+ ->andWhere ($ qb ->expr ()->eq ('d.fileHashAlgorithm ' , ':hashAlgorithm ' ))
373
+ ->setParameter (':hash ' , $ hash )
374
+ ->setParameter (':hashAlgorithm ' , $ hashAlgorithm )
375
+ ->setMaxResults (1 );
376
+
377
+ return $ qb ->getQuery ()->getOneOrNullResult ();
378
+ }
379
+
368
380
/**
369
381
* This method allows to pre-filter Documents with a given translation.
370
382
*/
You can’t perform that action at this time.
0 commit comments