Add PersonIdentifierManagerInterface to PersonACLAwareRepository and enhance search logic for identifiers

- Inject `PersonIdentifierManagerInterface` into `PersonACLAwareRepository` for improved identifier handling.
- Update search queries to include logic for filtering and matching `PersonIdentifier` values.
- Modify test cases to support the new dependency and ensure proper coverage.
This commit is contained in:
2025-09-24 00:01:28 +02:00
parent 34af53130b
commit 0fd76d3fa8
2 changed files with 48 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ use Chill\MainBundle\Repository\CountryRepository;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\PersonPhone;
use Chill\PersonBundle\PersonIdentifier\PersonIdentifierManagerInterface;
use Chill\PersonBundle\Repository\PersonACLAwareRepository;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\EntityManagerInterface;
@@ -42,6 +43,8 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase
private EntityManagerInterface $entityManager;
private PersonIdentifierManagerInterface $personIdentifierManager;
protected function setUp(): void
{
self::bootKernel();
@@ -49,6 +52,8 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
$this->countryRepository = self::getContainer()->get(CountryRepository::class);
$this->centerRepository = self::getContainer()->get(CenterRepositoryInterface::class);
$this->personIdentifierManager = self::getContainer()->get(PersonIdentifierManagerInterface::class);
}
public function testCountByCriteria()
@@ -66,7 +71,8 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase
$security->reveal(),
$this->entityManager,
$this->countryRepository,
$authorizationHelper->reveal()
$authorizationHelper->reveal(),
$this->personIdentifierManager,
);
$number = $repository->countBySearchCriteria('diallo');
@@ -89,7 +95,8 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase
$security->reveal(),
$this->entityManager,
$this->countryRepository,
$authorizationHelper->reveal()
$authorizationHelper->reveal(),
$this->personIdentifierManager,
);
$results = $repository->findBySearchCriteria(0, 5, false, 'diallo');
@@ -120,7 +127,8 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase
$security->reveal(),
$this->entityManager,
$this->countryRepository,
$authorizationHelper->reveal()
$authorizationHelper->reveal(),
$this->personIdentifierManager,
);
$actual = $repository->findByPhone($phoneNumber, 0, 10);