src/Entity/NewslettersSubscribers.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NewslettersSubscribersRepository;
  4. use App\Traits\CommonTrt;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=NewslettersSubscribersRepository::class)
  11.  * @UniqueEntity(fields = {"email"}, message ="Désolé, cet email est déjà enregistré ! Prière le changer.")
  12.  */
  13. class NewslettersSubscribers
  14. {
  15.     use CommonTrt;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, unique="true")
  24.      */
  25.     private $email;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $validationToken;
  30.     /**
  31.      * @ORM\Column(type="boolean")
  32.      */
  33.     private $isValid = false;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=NewslettersSent::class, mappedBy="subscribers")
  36.      */
  37.     private $newslettersSents;
  38. //    /**
  39. //     * @ORM\Column(type="boolean")
  40. //     */
  41. //    private $is_rgpd;
  42.     public function __construct()
  43.     {
  44.         $this->newslettersSents = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getEmail(): ?string
  51.     {
  52.         return $this->email;
  53.     }
  54.     public function setEmail(string $email): self
  55.     {
  56.         $this->email = $email;
  57.         return $this;
  58.     }
  59.     public function getValidationToken(): ?string
  60.     {
  61.         return $this->validationToken;
  62.     }
  63.     public function setValidationToken(?string $validationToken): self
  64.     {
  65.         $this->validationToken = $validationToken;
  66.         return $this;
  67.     }
  68.     public function getIsValid(): ?bool
  69.     {
  70.         return $this->isValid;
  71.     }
  72.     public function setIsValid(bool $isValid): self
  73.     {
  74.         $this->isValid = $isValid;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection|NewslettersSent[]
  79.      */
  80.     public function getNewslettersSents(): Collection
  81.     {
  82.         return $this->newslettersSents;
  83.     }
  84.     public function addNewslettersSent(NewslettersSent $newslettersSent): self
  85.     {
  86.         if (!$this->newslettersSents->contains($newslettersSent)) {
  87.             $this->newslettersSents[] = $newslettersSent;
  88.             $newslettersSent->setSubscribers($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeNewslettersSent(NewslettersSent $newslettersSent): self
  93.     {
  94.         if ($this->newslettersSents->removeElement($newslettersSent)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($newslettersSent->getSubscribers() === $this) {
  97.                 $newslettersSent->setSubscribers(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102. //    public function getIsRgpd(): ?bool
  103. //    {
  104. //        return $this->is_rgpd;
  105. //    }
  106. //
  107. //    public function setIsRgpd(bool $is_rgpd): self
  108. //    {
  109. //        $this->is_rgpd = $is_rgpd;
  110. //
  111. //        return $this;
  112. //    }
  113. }