src/Entity/TelegramCampaignMessage.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\TelegramCampaignMessage\Insert;
  4. use App\Repository\TelegramCampaignMessageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=TelegramCampaignMessageRepository::class)
  10.  */
  11. class TelegramCampaignMessage
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="text", nullable=true)
  21.      */
  22.     private $text;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Image::class)
  25.      */
  26.     private $image;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=TelegramCampaign::class, inversedBy="messages")
  29.      */
  30.     private $telegramCampaign;
  31.     /**
  32.      * @ORM\Column(type="boolean", nullable=true)
  33.      */
  34.     private $sendPaymentRequisites;
  35.     /**
  36.      * Не-персистентное поле для загрузки нового изображения через форму
  37.      */
  38.     private $newImage;
  39.     /**
  40.      * @ORM\ManyToMany(targetEntity=Image::class)
  41.      */
  42.     private $images;
  43.     public function __construct()
  44.     {
  45.         $this->images = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getText(): ?string
  52.     {
  53.         return $this->text;
  54.     }
  55.     public function setText(?string $text): self
  56.     {
  57.         $this->text $text;
  58.         return $this;
  59.     }
  60.     public function getImage(): ?Image
  61.     {
  62.         return $this->image;
  63.     }
  64.     public function setImage(?Image $image): self
  65.     {
  66.         $this->image $image;
  67.         return $this;
  68.     }
  69.     public function getTelegramCampaign(): ?TelegramCampaign
  70.     {
  71.         return $this->telegramCampaign;
  72.     }
  73.     public function setTelegramCampaign(?TelegramCampaign $telegramCampaign): self
  74.     {
  75.         $this->telegramCampaign $telegramCampaign;
  76.         return $this;
  77.     }
  78.     public function isSendPaymentRequisites(): ?bool
  79.     {
  80.         return $this->sendPaymentRequisites;
  81.     }
  82.     public function setSendPaymentRequisites(?bool $sendPaymentRequisites): self
  83.     {
  84.         $this->sendPaymentRequisites $sendPaymentRequisites;
  85.         return $this;
  86.     }
  87.     public function getNewImage(): ?string
  88.     {
  89.         return $this->newImage;
  90.     }
  91.     public function setNewImage(?string $newImage): self
  92.     {
  93.         $this->newImage $newImage;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection<int, Image>
  98.      */
  99.     public function getImages(): Collection
  100.     {
  101.         return $this->images;
  102.     }
  103.     public function addImage(Image $image): self
  104.     {
  105.         if (!$this->images->contains($image)) {
  106.             $this->images[] = $image;
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeImage(Image $image): self
  111.     {
  112.         $this->images->removeElement($image);
  113.         return $this;
  114.     }
  115. }