mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 17:15:02 +00:00
Add unique constraint for PersonIdentifier
, implement UniqueIdentifierConstraint
with validation logic, and include supporting tests
- Introduce `UniqueIdentifierConstraint` and its validator for ensuring identifier uniqueness. - Add a database-level unique constraint on `PersonIdentifier` (`definition_id`, `value`). - Implement repository method to fetch identifiers by definition and value. - Include integration and unit tests for validation and repository functionality. - Update `Person` entity with `Assert\Valid` annotation for `identifiers`.
This commit is contained in:
@@ -12,10 +12,13 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Entity\Identifier;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\PersonIdentifier\Validator\UniqueIdentifierConstraint;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_person_identifier')]
|
||||
#[ORM\UniqueConstraint(name: 'chill_person_identifier_unique', columns: ['definition_id', 'value'])]
|
||||
#[UniqueIdentifierConstraint]
|
||||
class PersonIdentifier
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
Reference in New Issue
Block a user