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