src/Entity/ObjectComment.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ObjectCommentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassObjectCommentRepository::class)]
  8. class ObjectComment
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length50)]
  15.     private $reference_type;
  16.     #[ORM\Column(type'integer')]
  17.     private $reference_id;
  18.     #[ORM\Column(type'text')]
  19.     private $text;
  20.     #[ORM\Column(type'json')]
  21.     private $richtext = [];
  22.     #[ORM\Column(type'datetime')]
  23.     private $created_at;
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private $updated_at;
  26.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'objectComments')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private $user;
  29.     #[ORM\ManyToOne(targetEntityObjectComment::class, inversedBy'objectComments')]
  30.     private $parent_comment;
  31.     #[ORM\OneToMany(targetEntityObjectComment::class, mappedBy'parent_comment')]
  32.     private $objectComments;
  33.     public function __construct()
  34.     {
  35.         $this->objectComments = new ArrayCollection();
  36.         $this->created_at = new \DateTime();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getReferenceType(): ?string
  43.     {
  44.         return $this->reference_type;
  45.     }
  46.     public function setReferenceType(string $reference_type): self
  47.     {
  48.         $this->reference_type $reference_type;
  49.         return $this;
  50.     }
  51.     public function getReferenceId(): ?int
  52.     {
  53.         return $this->reference_id;
  54.     }
  55.     public function setReferenceId(int $reference_id): self
  56.     {
  57.         $this->reference_id $reference_id;
  58.         return $this;
  59.     }
  60.     public function getText(): ?string
  61.     {
  62.         return $this->text;
  63.     }
  64.     public function setText(string $text): self
  65.     {
  66.         $this->text $text;
  67.         return $this;
  68.     }
  69.     public function getRichtext(): ?array
  70.     {
  71.         return $this->richtext;
  72.     }
  73.     public function setRichtext(array $richtext): self
  74.     {
  75.         $this->richtext $richtext;
  76.         return $this;
  77.     }
  78.     public function getCreatedAt(): ?\DateTimeInterface
  79.     {
  80.         return $this->created_at;
  81.     }
  82.     public function setCreatedAt(\DateTimeInterface $created_at): self
  83.     {
  84.         $this->created_at $created_at;
  85.         return $this;
  86.     }
  87.     public function getUpdatedAt(): ?\DateTimeInterface
  88.     {
  89.         return $this->updated_at;
  90.     }
  91.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  92.     {
  93.         $this->updated_at $updated_at;
  94.         return $this;
  95.     }
  96.     public function getUser(): ?User
  97.     {
  98.         return $this->user;
  99.     }
  100.     public function setUser(?User $user): self
  101.     {
  102.         $this->user $user;
  103.         return $this;
  104.     }
  105.     public function getParentComment(): ?self
  106.     {
  107.         return $this->parent_comment;
  108.     }
  109.     public function setParentComment(?self $parent_comment): self
  110.     {
  111.         $this->parent_comment $parent_comment;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, self>
  116.      */
  117.     public function getObjectComments(): Collection
  118.     {
  119.         return $this->objectComments;
  120.     }
  121.     public function addObjectComment(self $objectComment): self
  122.     {
  123.         if (!$this->objectComments->contains($objectComment)) {
  124.             $this->objectComments[] = $objectComment;
  125.             $objectComment->setParentComment($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeObjectComment(self $objectComment): self
  130.     {
  131.         if ($this->objectComments->removeElement($objectComment)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($objectComment->getParentComment() === $this) {
  134.                 $objectComment->setParentComment(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139. }