Skip to content

[Validator][RFC] Unique Constraint could have a errorPath parameter #57503

Closed
@Crovitche-1623

Description

@Crovitche-1623

Description

It could be a great improvement if the Unique Constraint could take a errorPath parameter (like the UniqueEntity constraint) pointing to the field that is a duplicate. This will be even more relevant if this PR is merged.

Example

Using the example provided in the documentation:

<?php
// src/Entity/PointOfInterest.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class PointOfInterest
{
    #[Assert\Unique(fields: ['latitude', 'longitude'], errorPath: 'latitude')]
    protected array $coordinates;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)Validator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy