src/Entity/Comment.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CommentRepository::class)
  9.  */
  10. class Comment
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="text", nullable=true)
  20.      */
  21.     private $description;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="comments")
  24.      */
  25.     private $document;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Comment::class, inversedBy="comments")
  28.      */
  29.     private $childComment;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="childComment")
  32.      */
  33.     private $comments;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments")
  36.      */
  37.     private $user;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="notes")
  40.      */
  41.     private $client;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Supplier::class, inversedBy="comments")
  44.      */
  45.     private $supplier;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="comments")
  48.      */
  49.     private $contact;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="documentComments")
  52.      */
  53.     private $documentComment;
  54.     /**
  55.      * @ORM\Column(type="datetime")
  56.      */
  57.     private $createAt;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity=Produit::class, inversedBy="comments")
  60.      */
  61.     private $produit;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity=Pack::class, inversedBy="comments")
  64.      */
  65.     private $pack;
  66.     /**
  67.      * @ORM\Column(type="boolean", options={"default": false})
  68.      */
  69.     private $isPublic false;
  70.     /**
  71.      * @ORM\Column(type="boolean", options={"default": false})
  72.      */
  73.     private bool $isPinned false;
  74.     /**
  75.      * @ORM\Column(type="smallint", nullable=true)
  76.      */
  77.     private ?int $rating null;
  78.     public function __construct()
  79.     {
  80.         $this->comments = new ArrayCollection();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getDescription(): ?string
  87.     {
  88.         return $this->description;
  89.     }
  90.     public function setDescription(?string $description): self
  91.     {
  92.         $this->description $description;
  93.         return $this;
  94.     }
  95.     public function getDocument(): ?Document
  96.     {
  97.         return $this->document;
  98.     }
  99.     public function setDocument(?Document $document): self
  100.     {
  101.         $this->document $document;
  102.         return $this;
  103.     }
  104.     public function getChildComment(): ?self
  105.     {
  106.         return $this->childComment;
  107.     }
  108.     public function setChildComment(?self $childComment): self
  109.     {
  110.         $this->childComment $childComment;
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection|self[]
  115.      */
  116.     public function getComments(): Collection
  117.     {
  118.         return $this->comments;
  119.     }
  120.     public function addComment(self $comment): self
  121.     {
  122.         if( !$this->comments->contains($comment)) {
  123.             $this->comments[] = $comment;
  124.             $comment->setChildComment($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeComment(self $comment): self
  129.     {
  130.         if( $this->comments->removeElement($comment)) {
  131.             // set the owning side to null (unless already changed)
  132.             if( $comment->getChildComment() === $this) {
  133.                 $comment->setChildComment(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     public function getUser(): ?User
  139.     {
  140.         return $this->user;
  141.     }
  142.     public function setUser(?User $user): self
  143.     {
  144.         $this->user $user;
  145.         return $this;
  146.     }
  147.     public function getDocumentComment(): ?Document
  148.     {
  149.         return $this->documentComment;
  150.     }
  151.     public function setDocumentComment(?Document $documentComment): self
  152.     {
  153.         $this->documentComment $documentComment;
  154.         return $this;
  155.     }
  156.     public function getClient(): ?User
  157.     {
  158.         return $this->client;
  159.     }
  160.     public function setClient(?User $client): self
  161.     {
  162.         $this->client $client;
  163.         return $this;
  164.     }
  165.     public function getSupplier(): ?Supplier
  166.     {
  167.         return $this->supplier;
  168.     }
  169.     public function setSupplier(?Supplier $supplier): self
  170.     {
  171.         $this->supplier $supplier;
  172.         return $this;
  173.     }
  174.     public function getContact(): ?Contact
  175.     {
  176.         return $this->contact;
  177.     }
  178.     public function setContact(?Contact $contact): self
  179.     {
  180.         $this->contact $contact;
  181.         return $this;
  182.     }
  183.     public function getCreateAt(): ?\DateTimeInterface
  184.     {
  185.         return $this->createAt;
  186.     }
  187.     public function setCreateAt(\DateTimeInterface $createAt): self
  188.     {
  189.         $this->createAt $createAt;
  190.         return $this;
  191.     }
  192.     public function getProduit(): ?Produit
  193.     {
  194.         return $this->produit;
  195.     }
  196.     public function setProduit(?Produit $produit): self
  197.     {
  198.         $this->produit $produit;
  199.         return $this;
  200.     }
  201.     public function getPack(): ?Pack
  202.     {
  203.         return $this->pack;
  204.     }
  205.     public function setPack(?Pack $pack): self
  206.     {
  207.         $this->pack $pack;
  208.         return $this;
  209.     }
  210.     public function isPublic(): bool
  211.     {
  212.         return (bool) $this->isPublic;
  213.     }
  214.     public function getIsPublic(): bool
  215.     {
  216.         return (bool) $this->isPublic;
  217.     }
  218.     public function setIsPublic(bool $isPublic): self
  219.     {
  220.         $this->isPublic $isPublic;
  221.         return $this;
  222.     }
  223.      public function isPinned(): bool
  224.     {
  225.         return (bool) $this->isPinned;
  226.     }
  227.     public function getIsPinned(): bool
  228.     {
  229.         return (bool) $this->isPinned;
  230.     }
  231.     public function setIsPinned(bool $isPinned): self
  232.     {
  233.         $this->isPinned $isPinned;
  234.         return $this;
  235.     }
  236.     public function getRating(): ?int
  237.     {
  238.         return $this->rating;
  239.     }
  240.     public function setRating(?int $rating): self
  241.     {
  242.         $this->rating $rating;
  243.         return $this;
  244.     }
  245. }