src/Entity/Gos/SmsSendingMoment.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\SmsSendingMomentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SmsSendingMomentRepository::class)
  9.  * @ORM\HasLifecycleCallbacks
  10.  */
  11. class SmsSendingMoment
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="datetime")
  25.      */
  26.     private $createdAt;
  27.     /**
  28.      * @ORM\Column(type="datetime", nullable=true)
  29.      */
  30.     private $updatedAt;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=SmsBody::class, mappedBy="smsSendingMoment")
  33.      */
  34.     private $smsBodies;
  35.     public function __construct()
  36.     {
  37.         $this->smsBodies = new ArrayCollection();
  38.     }
  39.     /** @ORM\PrePersist() */
  40.     public function prePersist()
  41.     {
  42.         $this->createdAt = new \DateTime();
  43.     }
  44.     /** @ORM\PreUpdate() */
  45.     public function preUpdate()
  46.     {
  47.         $this->updatedAt = new \DateTime();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function getCreatedAt(): ?\DateTimeInterface
  63.     {
  64.         return $this->createdAt;
  65.     }
  66.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  67.     {
  68.         $this->createdAt $createdAt;
  69.         return $this;
  70.     }
  71.     public function getUpdatedAt(): ?\DateTimeInterface
  72.     {
  73.         return $this->updatedAt;
  74.     }
  75.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  76.     {
  77.         $this->updatedAt $updatedAt;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|SmsBody[]
  82.      */
  83.     public function getSmsBodies(): Collection
  84.     {
  85.         return $this->smsBodies;
  86.     }
  87.     public function addSmsBody(SmsBody $smsBody): self
  88.     {
  89.         if (!$this->smsBodies->contains($smsBody)) {
  90.             $this->smsBodies[] = $smsBody;
  91.             $smsBody->setSmsSendingMoment($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeSmsBody(SmsBody $smsBody): self
  96.     {
  97.         if ($this->smsBodies->contains($smsBody)) {
  98.             $this->smsBodies->removeElement($smsBody);
  99.             // set the owning side to null (unless already changed)
  100.             if ($smsBody->getSmsSendingMoment() === $this) {
  101.                 $smsBody->setSmsSendingMoment(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106. }