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=Document::class, inversedBy="documentComments")
  44.      */
  45.     private $documentComment;
  46.     /**
  47.      * @ORM\Column(type="datetime")
  48.      */
  49.     private $createAt;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=Produit::class, inversedBy="comments")
  52.      */
  53.     private $produit;
  54.     public function __construct()
  55.     {
  56.         $this->comments = new ArrayCollection();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getDescription(): ?string
  63.     {
  64.         return $this->description;
  65.     }
  66.     public function setDescription(?string $description): self
  67.     {
  68.         $this->description $description;
  69.         return $this;
  70.     }
  71.     public function getDocument(): ?Document
  72.     {
  73.         return $this->document;
  74.     }
  75.     public function setDocument(?Document $document): self
  76.     {
  77.         $this->document $document;
  78.         return $this;
  79.     }
  80.     public function getChildComment(): ?self
  81.     {
  82.         return $this->childComment;
  83.     }
  84.     public function setChildComment(?self $childComment): self
  85.     {
  86.         $this->childComment $childComment;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection|self[]
  91.      */
  92.     public function getComments(): Collection
  93.     {
  94.         return $this->comments;
  95.     }
  96.     public function addComment(self $comment): self
  97.     {
  98.         if( !$this->comments->contains($comment)) {
  99.             $this->comments[] = $comment;
  100.             $comment->setChildComment($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeComment(self $comment): self
  105.     {
  106.         if( $this->comments->removeElement($comment)) {
  107.             // set the owning side to null (unless already changed)
  108.             if( $comment->getChildComment() === $this) {
  109.                 $comment->setChildComment(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getUser(): ?User
  115.     {
  116.         return $this->user;
  117.     }
  118.     public function setUser(?User $user): self
  119.     {
  120.         $this->user $user;
  121.         return $this;
  122.     }
  123.     public function getDocumentComment(): ?Document
  124.     {
  125.         return $this->documentComment;
  126.     }
  127.     public function setDocumentComment(?Document $documentComment): self
  128.     {
  129.         $this->documentComment $documentComment;
  130.         return $this;
  131.     }
  132.     public function getClient(): ?User
  133.     {
  134.         return $this->client;
  135.     }
  136.     public function setClient(?User $client): self
  137.     {
  138.         $this->client $client;
  139.         return $this;
  140.     }
  141.     public function getCreateAt(): ?\DateTimeInterface
  142.     {
  143.         return $this->createAt;
  144.     }
  145.     public function setCreateAt(\DateTimeInterface $createAt): self
  146.     {
  147.         $this->createAt $createAt;
  148.         return $this;
  149.     }
  150.     public function getProduit(): ?Produit
  151.     {
  152.         return $this->produit;
  153.     }
  154.     public function setProduit(?Produit $produit): self
  155.     {
  156.         $this->produit $produit;
  157.         return $this;
  158.     }
  159. }