src/Entity/Sms/PreparedSMSCommunication.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Sms;
  3. use App\Annotation\SiteAware;
  4. use App\Doctrine\Generator\PreparedSMSComunicationIdGenerator;
  5. use App\Entity\Interfaces\SiteInterface;
  6. use App\Entity\MiniAbstractBase;
  7. use App\Entity\Traits\CreatedAtTrait;
  8. use App\Entity\Traits\SiteTrait;
  9. use App\Repository\Sms\PreparedSMSCommunicationRepository;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14.  * @ORM\Table(name="vulco_prepared_sms_comunication")
  15.  *
  16.  * @ORM\Entity(repositoryClass=PreparedSMSCommunicationRepository::class)
  17.  *
  18.  * @SiteAware(siteFieldName="site")
  19.  */
  20. class PreparedSMSCommunication implements SiteInterface
  21. {
  22.     use CreatedAtTrait;
  23.     use SiteTrait;
  24.     /**
  25.      * @ORM\Id
  26.      *
  27.      * @ORM\Column(type="prepared_sms_comunication_id", length=255, nullable=false)
  28.      *
  29.      * @ORM\GeneratedValue(strategy="CUSTOM")
  30.      *
  31.      * @ORM\CustomIdGenerator(class=PreparedSMSComunicationIdGenerator::class)
  32.      */
  33.     private string $id;
  34.     /**
  35.      * @ORM\Column(type="integer", nullable=false)
  36.      */
  37.     private int $amount;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=false)
  40.      */
  41.     private string $deliveredTo;
  42.     /**
  43.      * @ORM\Column(type="text", length=10000, nullable=false)
  44.      */
  45.     private string $content;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity="App\Entity\Sms\SMSComunicationRow", mappedBy="communication", cascade={"persist", "remove"})
  48.      */
  49.     private ?Collection $rows;
  50.     public function __construct()
  51.     {
  52.         $this->rows = new ArrayCollection();
  53.     }
  54.     public function getId(): string
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getAmount(): int
  59.     {
  60.         return $this->amount;
  61.     }
  62.     public function setAmount(int $amount): self
  63.     {
  64.         $this->amount $amount;
  65.         return $this;
  66.     }
  67.     public function getDeliveredTo(): string
  68.     {
  69.         return $this->deliveredTo;
  70.     }
  71.     public function setDeliveredTo(string $deliveredTo): self
  72.     {
  73.         $this->deliveredTo $deliveredTo;
  74.         return $this;
  75.     }
  76.     public function getContent(): string
  77.     {
  78.         return $this->content;
  79.     }
  80.     public function setContent(string $content): self
  81.     {
  82.         $this->content $content;
  83.         return $this;
  84.     }
  85.     public function getRows(): ?Collection
  86.     {
  87.         return $this->rows;
  88.     }
  89.     public function getRowsAmount(): int
  90.     {
  91.         return count($this->getRows());
  92.     }
  93.     public function setRows(?Collection $rows): self
  94.     {
  95.         $this->rows $rows;
  96.         return $this;
  97.     }
  98.     public function addRow(SMSComunicationRow $row): self
  99.     {
  100.         if (!$this->rows->contains($row)) {
  101.             $this->rows->add($row);
  102.             $row->setCommunication($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeRow(SMSComunicationRow $row): self
  107.     {
  108.         if ($this->rows->contains($row)) {
  109.             $this->rows->removeElement($row);
  110.         }
  111.         return $this;
  112.     }
  113.     public function __toString(): string
  114.     {
  115.         return $this->id $this->getId() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  116.     }
  117. }