<?php
namespace App\Entity;
use App\Entity\SuperClass\BaseEntity;
use App\Repository\NewsletterRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=NewsletterRepository::class)
* @UniqueEntity("email" , message="Email is already registered for the monthly insights")
*/
class Newsletter extends BaseEntity
{
/**
* @ORM\Column(type="string", length=255 , unique=true )
* @Assert\NotBlank
* @Assert\Email(
* message = "The email '{{ value }}' is not a valid email."
* )
*/
private ?string $email;
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
}