src/Entity/Message.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\Collection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\NewsletterRepository;
  6. /**
  7.  * class Message
  8.  *
  9.  * @ORM\Entity(repositoryClass="App\Repository\MessageRepository")
  10.  *
  11.  * @ORM\Entity
  12.  */
  13. class Message
  14. {
  15.     const RESOURCE_KEY 'messages';
  16.     /**
  17.      * @ORM\Id()
  18.      * @ORM\GeneratedValue()
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\ManyToMany(targetEntity="Newsletter", inversedBy="messages")
  24.      * @ORM\JoinTable(name="newsletter_content_messages",
  25.      *      joinColumns={@ORM\JoinColumn(name="newsletter_id", referencedColumnName="id")},
  26.      *      inverseJoinColumns={@ORM\JoinColumn(name="message_id", referencedColumnName="id")}
  27.      *      )
  28.      */
  29.     private $newsletters;
  30.     /**
  31.      * @ORM\Column(type="string", length=400, nullable=true)
  32.      */
  33.     private $subject;
  34.     /**
  35.      *@ORM\Column(type="text")
  36.      */
  37.     private $text;
  38.     /**
  39.     * @ORM\Column(type="datetime")
  40.     */
  41.     private $sendAt;
  42.     /**
  43.      * @return mixed
  44.      */
  45.     public function __construct() {
  46.         $this->newsletters = new \Doctrine\Common\Collections\ArrayCollection();
  47.     }
  48.     public function getId()
  49.     {
  50.         return $this->id;
  51.     }
  52.     /**
  53.      * @return mixed
  54.      */
  55.     public function getSubject()
  56.     {
  57.         return $this->subject;
  58.     }
  59.     /**
  60.      * @param mixed $subject
  61.      */
  62.     public function setSubject($subject): void
  63.     {
  64.         $this->subject $subject;
  65.     }
  66.     /**
  67.      * @return mixed
  68.      */
  69.     public function getText()
  70.     {
  71.         return $this->text;
  72.     }
  73.     /**
  74.      * @param mixed $text
  75.      */
  76.     public function setText($text): void
  77.     {
  78.         $this->text $text;
  79.     }
  80.     /**
  81.      * @return mixed
  82.      */
  83.     public function getSendAt()
  84.     {
  85.         return $this->sendAt;
  86.     }
  87.     /**
  88.      * @param mixed $sendAt
  89.      */
  90.     public function setSendAt($sendAt): void
  91.     {
  92.         $this->sendAt $sendAt;
  93.     }
  94.     /**
  95.      * @return Collection|Tag[]
  96.      */
  97.     public function getNewsletters(): Collection
  98.     {
  99.         return $this->newsletters;
  100.     }
  101.     public function addNewsletter(Newsletter $newsletter): self
  102.     {
  103.         if (!$this->newsletters->contains($newsletter)) {
  104.             $this->newsletters[] = $newsletter;
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeNewsletter(Newsletter $newsletter): self
  109.     {
  110.         if ($this->newsletters->contains($newsletter)) {
  111.             $this->newsletters->removeElement($newsletter);
  112.         }
  113.         return $this;
  114.     }
  115. }