<?php
namespace App\Entity;
use App\Repository\EmailingProspectRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: EmailingProspectRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'Cet e-mail existe déjà')]
class EmailingProspect
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
#[Assert\NotBlank(message: "L'email ne doit pas être vide.")]
#[Assert\Email(message: "L'email {{ value }} n'est pas valide.")]
private $email;
#[ORM\Column(type: 'boolean', nullable: true)]
private $unsubscribe;
#[ORM\Column(type: 'boolean', nullable: true)]
private $remove;
#[ORM\Column(type: 'datetime_immutable')]
private $createdAt;
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
}
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;
}
public function isUnsubscribe(): ?bool
{
return $this->unsubscribe;
}
public function setUnsubscribe(?bool $unsubscribe): self
{
$this->unsubscribe = $unsubscribe;
return $this;
}
public function isRemove(): ?bool
{
return $this->remove;
}
public function setRemove(?bool $remove): self
{
$this->remove = $remove;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
}