Skip to content

[Validator] Unique constraint error path #46182

@norkunas

Description

@norkunas

Description

Now that UniqueValidator supports providing which fields to check for uniqueness it would be also useful to be able to provide errorPath like in UniqueEntityValidator.

Otherwise the errors are not shown when you use Form CollectionType and with an array of DTO's and normalizer option.

Example

class Input {
    /** @var MetadataInput[] */
    #[Unique(normalizer: [MetadataInput::class, 'getKeyForUniqueConstraint'], errorPath: 'key')
    public $metadata;
}

class MetadataInput {
  public $key;
  public $value;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions