src/Entity/Newsletter.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NewsletterRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=NewsletterRepository::class)
  7.  */
  8. class Newsletter
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=180)
  18.      */
  19.     private $email;
  20.     /**
  21.      * @ORM\Column(type="datetime")
  22.      */
  23.     private $createdAt;
  24.     public function __construct()
  25.     {
  26.         $this->createdAt = new \DateTime();
  27.     }
  28.     /**
  29.      * @return int|null
  30.      */
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     /**
  36.      * @return string|null
  37.      */
  38.     public function getEmail(): ?string
  39.     {
  40.         return $this->email;
  41.     }
  42.     /**
  43.      * @param string $email
  44.      * @return $this
  45.      */
  46.     public function setEmail(string $email): self
  47.     {
  48.         $this->email $email;
  49.         return $this;
  50.     }
  51.     /**
  52.      * @return \DateTimeInterface|null
  53.      */
  54.     public function getCreatedAt(): ?\DateTimeInterface
  55.     {
  56.         return $this->createdAt;
  57.     }
  58.     /**
  59.      * @param \DateTimeInterface $createdAt
  60.      * @return $this
  61.      */
  62.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  63.     {
  64.         $this->createdAt $createdAt;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return string|null
  69.      */
  70.     public function __toString()
  71.     {
  72.         return $this->getEmail();
  73.     }
  74. }