Closed
Description
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;
}