diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 182a90d5a..e91732269 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -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); diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 98dc14110..f919c38a2 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -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'; diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml index f5ead52f7..e7c43bb7f 100644 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml @@ -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'