src/Entity/DiscussionClassMessage.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\DiscussionClassMessageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassDiscussionClassMessageRepository::class)]
  11. #[ORM\HasLifecycleCallbacks]
  12. class DiscussionClassMessage
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  19.     private ?int $id null;
  20.     #[ORM\ManyToOne(inversedBy'discussionClassMessages')]
  21.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  22.     private ?DiscussionClass $discussion null;
  23.     #[ORM\ManyToOne(inversedBy'discussionClassMessages')]
  24.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  25.     private ?User $author null;
  26.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  27.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  28.     private ?string $message null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  31.     private ?string $file_name null;
  32.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'discussionClassMessages')]
  33.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  34.     private ?self $replyToMessage null;
  35.     #[ORM\OneToMany(mappedBy'replyToMessage'targetEntityself::class)]
  36.     private Collection $discussionClassMessages;
  37.     #[ORM\Column(nullabletrue)]
  38.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  39.     private ?int $size null;
  40.     #[ORM\Column(nullabletrue)]
  41.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  42.     private ?int $duration null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  45.     private ?string $cachedSenderPath null;
  46.     #[ORM\Column(length255nullabletrue)]
  47.     #[Groups(['getDiscussionClass''getDiscussionMessage'])]
  48.     private ?string $cachedReciverPath null;
  49.     #[ORM\Column(nullabletrue)]
  50.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  51.     private ?string $localId null;
  52.     #[ORM\Column(length255)]
  53.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  54.     private ?string $type null;
  55.     #[ORM\Column(length255nullabletrue)]
  56.     #[Groups(['getDiscussionClass''getDiscussionClassMessage'])]
  57.     private ?string $url null;
  58.     #[ORM\ManyToMany(targetEntityUser::class, inversedBy'discussionClassMessagesRead')]
  59.     private Collection $readers;
  60.     public function __construct()
  61.     {
  62.         $this->discussionClassMessages = new ArrayCollection();
  63.         $this->readers = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getDiscussion(): ?DiscussionClass
  70.     {
  71.         return $this->discussion;
  72.     }
  73.     public function setDiscussion(?DiscussionClass $discussion): static
  74.     {
  75.         $this->discussion $discussion;
  76.         return $this;
  77.     }
  78.     public function getAuthor(): ?User
  79.     {
  80.         return $this->author;
  81.     }
  82.     public function setAuthor(?User $author): static
  83.     {
  84.         $this->author $author;
  85.         return $this;
  86.     }
  87.     public function getMessage(): ?string
  88.     {
  89.         return $this->message;
  90.     }
  91.     public function setMessage(?string $message): static
  92.     {
  93.         $this->message $message;
  94.         return $this;
  95.     }
  96.     public function getFileName(): ?string
  97.     {
  98.         return $this->file_name;
  99.     }
  100.     public function setFileName(?string $file_name): static
  101.     {
  102.         $this->file_name $file_name;
  103.         return $this;
  104.     }
  105.     public function getReplyToMessage(): ?self
  106.     {
  107.         return $this->replyToMessage;
  108.     }
  109.     public function setReplyToMessage(?self $replyToMessage): static
  110.     {
  111.         $this->replyToMessage $replyToMessage;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, self>
  116.      */
  117.     public function getDiscussionClassMessages(): Collection
  118.     {
  119.         return $this->discussionClassMessages;
  120.     }
  121.     public function addDiscussionClassMessage(self $discussionClassMessage): static
  122.     {
  123.         if (!$this->discussionClassMessages->contains($discussionClassMessage)) {
  124.             $this->discussionClassMessages->add($discussionClassMessage);
  125.             $discussionClassMessage->setReplyToMessage($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeDiscussionClassMessage(self $discussionClassMessage): static
  130.     {
  131.         if ($this->discussionClassMessages->removeElement($discussionClassMessage)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($discussionClassMessage->getReplyToMessage() === $this) {
  134.                 $discussionClassMessage->setReplyToMessage(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139.     public function getSize(): ?int
  140.     {
  141.         return $this->size;
  142.     }
  143.     public function setSize(?int $size): static
  144.     {
  145.         $this->size $size;
  146.         return $this;
  147.     }
  148.     public function getDuration(): ?int
  149.     {
  150.         return $this->duration;
  151.     }
  152.     public function setDuration(?int $duration): static
  153.     {
  154.         $this->duration $duration;
  155.         return $this;
  156.     }
  157.     public function getCachedSenderPath(): ?string
  158.     {
  159.         return $this->cachedSenderPath;
  160.     }
  161.     public function setCachedSenderPath(?string $cachedSenderPath): static
  162.     {
  163.         $this->cachedSenderPath $cachedSenderPath;
  164.         return $this;
  165.     }
  166.     public function getCachedReciverPath(): ?string
  167.     {
  168.         return $this->cachedReciverPath;
  169.     }
  170.     public function setCachedReciverPath(?string $cachedReciverPath): static
  171.     {
  172.         $this->cachedReciverPath $cachedReciverPath;
  173.         return $this;
  174.     }
  175.     public function getLocalId(): ?string
  176.     {
  177.         return $this->localId;
  178.     }
  179.     public function setLocalId(?string $localId): static
  180.     {
  181.         $this->localId $localId;
  182.         return $this;
  183.     }
  184.     public function getType(): ?string
  185.     {
  186.         return $this->type;
  187.     }
  188.     public function setType(string $type): static
  189.     {
  190.         $this->type $type;
  191.         return $this;
  192.     }
  193.     public function getUrl(): ?string
  194.     {
  195.         return $this->url;
  196.     }
  197.     public function setUrl(?string $url): static
  198.     {
  199.         $this->url $url;
  200.         return $this;
  201.     }
  202.     /**
  203.      * @return Collection<int, User>
  204.      */
  205.     public function getReaders(): Collection
  206.     {
  207.         return $this->readers;
  208.     }
  209.     public function addReader(User $reader): static
  210.     {
  211.         if (!$this->readers->contains($reader)) {
  212.             $this->readers->add($reader);
  213.         }
  214.         return $this;
  215.     }
  216.     public function removeReader(User $reader): static
  217.     {
  218.         $this->readers->removeElement($reader);
  219.         return $this;
  220.     }
  221. }