person: replace SimilarPersonMatcher by PersonACLAwareRepository method

This commit is contained in:
nobohan 2022-02-17 11:53:51 +01:00
parent a3ffd2709d
commit bc08719c0c
3 changed files with 15 additions and 8 deletions

View File

@ -20,9 +20,9 @@ use Chill\PersonBundle\Entity\PersonNotDuplicate;
use Chill\PersonBundle\Form\PersonConfimDuplicateType;
use Chill\PersonBundle\Form\PersonFindManuallyDuplicateType;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\PersonBundle\Repository\PersonACLAwareRepositoryInterface;
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Search\SimilarPersonMatcher;
use Chill\TaskBundle\Entity\SingleTask;
use http\Exception\InvalidArgumentException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@ -50,9 +50,9 @@ class PersonDuplicateController extends Controller
private $personRepository;
/**
* @var \Chill\PersonBundle\Search\SimilarPersonMatcher
* @var PersonACLAwareRepositoryInterface
*/
private $similarPersonMatcher;
private $personACLAwareRepository;
/**
* @var \Symfony\Component\Translation\TranslatorInterface
@ -60,13 +60,13 @@ class PersonDuplicateController extends Controller
private $translator;
public function __construct(
SimilarPersonMatcher $similarPersonMatcher,
PersonACLAwareRepositoryInterface $personACLAwareRepository,
TranslatorInterface $translator,
PersonRepository $personRepository,
PersonMove $personMove,
EventDispatcherInterface $eventDispatcher
) {
$this->similarPersonMatcher = $similarPersonMatcher;
$this->personACLAwareRepository = $personACLAwareRepository;
$this->translator = $translator;
$this->personRepository = $personRepository;
$this->personMove = $personMove;
@ -246,8 +246,12 @@ class PersonDuplicateController extends Controller
'You are not allowed to see this person.'
);
$duplicatePersons = $this->similarPersonMatcher->
matchPerson($person, $personNotDuplicateRepository, 0.5, SimilarPersonMatcher::SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL);
$duplicatePersons = $this->personACLAwareRepository->findMatchingPersons(
$person,
0.5,
PersonACLAwareRepositoryInterface::SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL
);
$notDuplicatePersons = $personNotDuplicateRepository->findNotDuplicatePerson($person);

View File

@ -21,6 +21,9 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
use function count;
/*
* @deprecated
*/
class SimilarPersonMatcher
{
public const SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL = 'alphabetical';

View File

@ -24,7 +24,7 @@ services:
Chill\PersonBundle\Controller\PersonDuplicateController:
arguments:
$similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher'
$personACLAwareRepository: '@Chill\PersonBundle\Repository\PersonACLAwareRepositoryInterface'
$translator: '@Symfony\Component\Translation\TranslatorInterface'
$personRepository: '@Chill\PersonBundle\Repository\PersonRepository'
$personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove'