src/Entity/Newsletter.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\NewsletterRepository")
  8.  * @UniqueEntity(
  9.  *  fields={"email"},
  10.  *  message="Un utilisateur s'est déjà inscrit avec cette adresse email, merci de la modifier"
  11.  * )
  12.  */
  13. class Newsletter
  14. {
  15.     /**
  16.      * @ORM\Id()
  17.      * @ORM\GeneratedValue()
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255,unique=true)
  23.      * @Assert\Email(message = "The email '{{ value }}' n'est pas une adresse email valide.")
  24.      */
  25.     private $email;
  26.     /**
  27.      * @ORM\Column(type="datetime")
  28.      */
  29.     private $createdAt;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $owner;
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getEmail(): ?string
  39.     {
  40.         return $this->email;
  41.     }
  42.     public function setEmail(string $email): self
  43.     {
  44.         $this->email $email;
  45.         return $this;
  46.     }
  47.     public function getCreatedAt(): ?\DateTimeInterface
  48.     {
  49.         return $this->createdAt;
  50.     }
  51.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  52.     {
  53.         $this->createdAt $createdAt;
  54.         return $this;
  55.     }
  56.     public function getOwner(): ?string
  57.     {
  58.         return $this->owner;
  59.     }
  60.     public function setOwner(string $owner): self
  61.     {
  62.         $this->owner $owner;
  63.         return $this;
  64.     }
  65. }