mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
person: replace SimilarPersonMatcher by PersonACLAwareRepository method
This commit is contained in:
parent
a3ffd2709d
commit
bc08719c0c
@ -20,9 +20,9 @@ use Chill\PersonBundle\Entity\PersonNotDuplicate;
|
|||||||
use Chill\PersonBundle\Form\PersonConfimDuplicateType;
|
use Chill\PersonBundle\Form\PersonConfimDuplicateType;
|
||||||
use Chill\PersonBundle\Form\PersonFindManuallyDuplicateType;
|
use Chill\PersonBundle\Form\PersonFindManuallyDuplicateType;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
|
use Chill\PersonBundle\Repository\PersonACLAwareRepositoryInterface;
|
||||||
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
||||||
use Chill\PersonBundle\Repository\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
|
||||||
use Chill\TaskBundle\Entity\SingleTask;
|
use Chill\TaskBundle\Entity\SingleTask;
|
||||||
use http\Exception\InvalidArgumentException;
|
use http\Exception\InvalidArgumentException;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
@ -50,9 +50,9 @@ class PersonDuplicateController extends Controller
|
|||||||
private $personRepository;
|
private $personRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Chill\PersonBundle\Search\SimilarPersonMatcher
|
* @var PersonACLAwareRepositoryInterface
|
||||||
*/
|
*/
|
||||||
private $similarPersonMatcher;
|
private $personACLAwareRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Symfony\Component\Translation\TranslatorInterface
|
* @var \Symfony\Component\Translation\TranslatorInterface
|
||||||
@ -60,13 +60,13 @@ class PersonDuplicateController extends Controller
|
|||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SimilarPersonMatcher $similarPersonMatcher,
|
PersonACLAwareRepositoryInterface $personACLAwareRepository,
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
PersonRepository $personRepository,
|
PersonRepository $personRepository,
|
||||||
PersonMove $personMove,
|
PersonMove $personMove,
|
||||||
EventDispatcherInterface $eventDispatcher
|
EventDispatcherInterface $eventDispatcher
|
||||||
) {
|
) {
|
||||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
$this->personACLAwareRepository = $personACLAwareRepository;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->personRepository = $personRepository;
|
$this->personRepository = $personRepository;
|
||||||
$this->personMove = $personMove;
|
$this->personMove = $personMove;
|
||||||
@ -246,8 +246,12 @@ class PersonDuplicateController extends Controller
|
|||||||
'You are not allowed to see this person.'
|
'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);
|
$notDuplicatePersons = $personNotDuplicateRepository->findNotDuplicatePerson($person);
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
|||||||
|
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
class SimilarPersonMatcher
|
class SimilarPersonMatcher
|
||||||
{
|
{
|
||||||
public const SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL = 'alphabetical';
|
public const SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL = 'alphabetical';
|
||||||
|
@ -24,7 +24,7 @@ services:
|
|||||||
|
|
||||||
Chill\PersonBundle\Controller\PersonDuplicateController:
|
Chill\PersonBundle\Controller\PersonDuplicateController:
|
||||||
arguments:
|
arguments:
|
||||||
$similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher'
|
$personACLAwareRepository: '@Chill\PersonBundle\Repository\PersonACLAwareRepositoryInterface'
|
||||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
$personRepository: '@Chill\PersonBundle\Repository\PersonRepository'
|
$personRepository: '@Chill\PersonBundle\Repository\PersonRepository'
|
||||||
$personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove'
|
$personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user