FIX [personMatcher] wrong syntax was used to setParameter for query in similar person matcher

This commit is contained in:
Julie Lenaerts 2023-03-02 11:45:41 +01:00
parent ef75deda26
commit 73f332927d

View File

@ -79,6 +79,11 @@ class SimilarPersonMatcher
->where('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= :precision')
->andWhere($qb->expr()->in('p.center', ':centers'));
$qb
->setParameter('fullName', $this->personRender->renderString($person, []))
->setParameter('centers', $centers)
->setParameter('precision', $precision);
if (null !== $person->getBirthdate()) {
$qb->andWhere($qb->expr()->orX(
$qb->expr()->eq('p.birthdate', ':personBirthdate'),
@ -90,13 +95,13 @@ class SimilarPersonMatcher
if ($person->getId() !== null) {
$qb->andWhere($qb->expr()->neq('p.id', ':personId'));
$query->setParameter('personId', $person->getId());
$qb->setParameter('personId', $person->getId());
$notDuplicatePersons = $this->personNotDuplicateRepository->findNotDuplicatePerson($person);
if (count($notDuplicatePersons)) {
$qb->andWhere($qb->expr()->notIn('p.id', ':notDuplicatePersons'));
$query->setParameter('notDuplicatePersons', $notDuplicatePersons);
$qb->setParameter('notDuplicatePersons', $notDuplicatePersons);
}
}
@ -109,13 +114,10 @@ class SimilarPersonMatcher
case self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY:
default:
$qb->orderBy('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName)))', 'DESC');
$qb->setParameter('fullName', $this->personRender->renderString($person, []));
}
$qb
->setParameter('fullName', $this->personRender->renderString($person, []))
->setParameter('centers', $centers)
->setParameter('precision', $precision);
dump($qb->getQuery());
return $qb->getQuery()->getResult();
}
}