src/Entity/Newsletters.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NewslettersRepository;
  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. /**
  9.  * @ORM\Entity(repositoryClass=NewslettersRepository::class)
  10.  */
  11. class Newsletters
  12. {
  13.     use CommonTrt;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $intro;
  28.     /**
  29.      * @ORM\Column(type="text")
  30.      */
  31.     private $content;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $filename;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=NewslettersCategories::class, inversedBy="newsletters")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private $category;
  41.     /**
  42.      * @ORM\Column(type="boolean")
  43.      */
  44.     private $isSent = false;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=NewslettersSent::class, mappedBy="newsletter")
  47.      */
  48.     private $newslettersSents;
  49.     public function __construct()
  50.     {
  51.         $this->newslettersSents = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name = $name;
  64.         return $this;
  65.     }
  66.     public function getIntro(): ?string
  67.     {
  68.         return $this->intro;
  69.     }
  70.     public function setIntro(?string $intro): self
  71.     {
  72.         $this->intro = $intro;
  73.         return $this;
  74.     }
  75.     public function getContent(): ?string
  76.     {
  77.         return $this->content;
  78.     }
  79.     public function setContent(string $content): self
  80.     {
  81.         $this->content = $content;
  82.         return $this;
  83.     }
  84.     public function getFilename(): ?string
  85.     {
  86.         return $this->filename;
  87.     }
  88.     public function setFilename(?string $filename): self
  89.     {
  90.         $this->filename = $filename;
  91.         return $this;
  92.     }
  93.     public function getCategory(): ?NewslettersCategories
  94.     {
  95.         return $this->category;
  96.     }
  97.     public function setCategory(?NewslettersCategories $category): self
  98.     {
  99.         $this->category = $category;
  100.         return $this;
  101.     }
  102.     public function getIsSent(): ?bool
  103.     {
  104.         return $this->isSent;
  105.     }
  106.     public function setIsSent(bool $isSent): self
  107.     {
  108.         $this->isSent = $isSent;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection|NewslettersSent[]
  113.      */
  114.     public function getNewslettersSents(): Collection
  115.     {
  116.         return $this->newslettersSents;
  117.     }
  118.     public function addNewslettersSent(NewslettersSent $newslettersSent): self
  119.     {
  120.         if (!$this->newslettersSents->contains($newslettersSent)) {
  121.             $this->newslettersSents[] = $newslettersSent;
  122.             $newslettersSent->setNewsletter($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeNewslettersSent(NewslettersSent $newslettersSent): self
  127.     {
  128.         if ($this->newslettersSents->removeElement($newslettersSent)) {
  129.             // set the owning side to null (unless already changed)
  130.             if ($newslettersSent->getNewsletter() === $this) {
  131.                 $newslettersSent->setNewsletter(null);
  132.             }
  133.         }
  134.         return $this;
  135.     }
  136. }