mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 04:56:23 +00:00
29 lines
448 B
Markdown
29 lines
448 B
Markdown
---
|
|
date: 20201117
|
|
id: 5dbf9ea2-81ad-4b35-83ba-e4ab2e247c9a
|
|
title: ULID Constraint
|
|
---
|
|
|
|
# Syntax
|
|
|
|
``` php
|
|
// src/Entity/Product.php
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
|
|
*/
|
|
class Product
|
|
{
|
|
/**
|
|
* @ORM\Column(type="ulid")
|
|
* @Assert\Ulid
|
|
*/
|
|
private $someProperty;
|
|
|
|
// ...
|
|
}
|
|
```
|