wiki/content/20201112132331-unique_constraint.md

349 B

date id title
2020-11-12 ebceb7b8-5242-482b-b258-2cf9c25d1788 Unique Constraint

Syntax

// src/Entity/Person.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Person
{
    /**
     * @Assert\Unique(message="The {{ value }} email is repeated.")
     */
    protected $contactEmails;
}