emericanec/symfony-unique-entity-validator

Symfony UniqueEntity validator for any class (not only for ORM\Entity)

1.0.2 2020-03-28 20:46 UTC

This package is auto-updated.

Last update: 2024-10-29 05:53:25 UTC


README

Install:

composer require emericanec/symfony-unique-entity-validator

Usage:

<?php

use Emericanec\UniqueEntity; 

/**
 * @UniqueEntity(
 *     entityClass="App\Entity\User",
 *     fields={"email"}
 * )
 */
class RegistrationForm
{
    protected string $email;

    public function getEmail(): string
    {
        return $this->email;
    }
    
    public function setEmail(string $email): void
    {
        $this->email = $email;
    }

}