wiki/content/20201112132331-unique_constraint.md

23 lines
349 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-12
2024-05-06 20:40:05 +00:00
id: ebceb7b8-5242-482b-b258-2cf9c25d1788
title: Unique Constraint
---
# Syntax
``` php
// 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;
}
```