src/Entity/Comment.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\User;
  4. use App\Entity\Chantier;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Traits\EntityTrait;
  7. use App\Repository\CommentRepository;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CommentRepository::class)
  10.  */
  11. class Comment
  12. {
  13.     use EntityTrait {
  14.         EntityTrait::__construct as private __entityConstruct;
  15.     }
  16.     /**
  17.      * @ORM\Column(type="text")
  18.      */
  19.     private $content;
  20.     /**
  21.      * @ORM\Column(type="text",nullable=true)
  22.      */
  23.     private $type;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments")
  26.      * @ORM\JoinColumn(nullable=false)
  27.      */
  28.     private $user;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=Chantier::class, inversedBy="comments")
  31.      * @ORM\JoinColumn(nullable=false)
  32.      */
  33.     private $chantier;
  34.     public function __toString()
  35.     {
  36.         return $this->getUser()->getFullName();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getContent(): ?string
  43.     {
  44.         return $this->content;
  45.     }
  46.     public function setContent(string $content): self
  47.     {
  48.         $this->content $content;
  49.         return $this;
  50.     }
  51.     public function getType(): ?string
  52.     {
  53.         return $this->type;
  54.     }
  55.     public function setType(string $type): self
  56.     {
  57.         if ($type != 'null') {
  58.             $this->type $type;
  59.         }
  60.         else{
  61.             $this->type NULL;
  62.         }
  63.         
  64.         return $this;
  65.     }
  66.     public function getUser(): ?User
  67.     {
  68.         return $this->user;
  69.     }
  70.     public function setUser(?User $user): self
  71.     {
  72.         $this->user $user;
  73.         return $this;
  74.     }
  75.     public function getChantier(): ?Chantier
  76.     {
  77.         return $this->chantier;
  78.     }
  79.     public function setChantier(?Chantier $chantier): self
  80.     {
  81.         $this->chantier $chantier;
  82.         return $this;
  83.     }
  84. }