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\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7.  * Newsletter
  8.  *
  9.  * @ORM\Table(name="newsletter", indexes={@ORM\Index(name="joined", columns={"joined"}), @ORM\Index(name="email", columns={"email"})})
  10.  * @ORM\Entity
  11.  * @UniqueEntity("email")
  12.  */
  13. class Newsletter
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer", nullable=false)
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var string
  25.      *
  26.      * @ORM\Column(name="email", type="string", length=125, nullable=false)
  27.      * @Assert\NotBlank()
  28.      * @Assert\Email(
  29.      *     message = "Cet email n'est pas valide.",
  30.      *     checkMX = true
  31.      * )
  32.      */
  33.     private $email '';
  34.     /**
  35.      * @var int
  36.      *
  37.      * @ORM\Column(name="joined", type="integer", nullable=false)
  38.      */
  39.     private $joined '0';
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getEmail(): ?string
  45.     {
  46.         return $this->email;
  47.     }
  48.     public function setEmail(string $email): self
  49.     {
  50.         $this->email $email;
  51.         return $this;
  52.     }
  53.     public function getJoined(): ?int
  54.     {
  55.         return $this->joined;
  56.     }
  57.     public function setJoined(int $joined): self
  58.     {
  59.         $this->joined $joined;
  60.         return $this;
  61.     }
  62. }