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: 2021-11-29 00:43:18 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;
    }

}