src/Entity/ForumReponse.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ForumReponseRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. #[ORM\Entity(repositoryClassForumReponseRepository::class)]
  9. class ForumReponse
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(targetEntityUser::class)]
  16.     private $user;
  17.     #[ORM\Column(typeTypes::TEXT)]
  18.     private ?string $reponse null;
  19.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  20.     private ?\DateTimeInterface $date null;
  21.     #[ORM\Column(type'boolean')]
  22.     private $etat false;
  23.     #[ORM\ManyToOne(inversedBy'reponse')]
  24.     private ?Sujetforum $sujetforum null;
  25.     #[ORM\ManyToOne(inversedBy'children')]
  26.     private ?ForumReponse $parent;
  27.     #[ORM\OneToMany(mappedBy'parent'targetEntityForumReponse::class, cascade: ['persist''remove'])]
  28.     private Collection $children;
  29.     public function __construct()
  30.     {
  31.         $this->children = new ArrayCollection();
  32.     }
  33.      /**
  34.      * @return Collection<int, ForumReponse>
  35.      */
  36.     public function getChildren(): Collection
  37.     {
  38.         return $this->children;
  39.     }
  40.     public function addChildren(ForumReponse $children): self
  41.     {
  42.         if (!$this->children->contains($children)) {
  43.             $this->children->add($children);
  44.             $children->setParent($this);
  45.         }
  46.         return $this;
  47.     }
  48.     public function removeChildren(ForumReponse $children): self
  49.     {
  50.         if ($this->children->removeElement($children)) {
  51.             // set the owning side to null (unless already changed)
  52.             if ($children->getSujetforum() === $this) {
  53.                 $children->setSujetforum(null);
  54.             }
  55.         }
  56.         return $this;
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getUser(): ?User
  63.     {
  64.         return $this->user;
  65.     }
  66.     public function setUser(?User $user): ?self
  67.     {
  68.         $this->user $user;
  69.         return $this;
  70.     }
  71.     public function getReponse(): ?string
  72.     {
  73.         return $this->reponse;
  74.     }
  75.     public function setReponse(string $reponse): self
  76.     {
  77.         $this->reponse $reponse;
  78.         return $this;
  79.     }
  80.     public function getDate(): ?\DateTimeInterface
  81.     {
  82.         return $this->date;
  83.     }
  84.     public function setDate(?\DateTimeInterface $date): ?self
  85.     {
  86.         $this->date $date;
  87.         return $this;
  88.     }
  89.     public function isEtat(): ?bool
  90.     {
  91.         return $this->etat;
  92.     }
  93.     public function setEtat(bool $etat): self
  94.     {
  95.         $this->etat $etat;
  96.         return $this;
  97.     }
  98.     public function getSujetforum(): ?Sujetforum
  99.     {
  100.         return $this->sujetforum;
  101.     }
  102.     public function setSujetforum(?Sujetforum $sujetforum): self
  103.     {
  104.         $this->sujetforum $sujetforum;
  105.         return $this;
  106.     }
  107.     public function getParent(): ?ForumReponse
  108.     {
  109.         return $this->parent;
  110.     }
  111.     public function setParent(?ForumReponse $parent): self
  112.     {
  113.         $this->parent $parent;
  114.         return $this;
  115.     }
  116.     public function addChild(ForumReponse $child): self
  117.     {
  118.         if (!$this->children->contains($child)) {
  119.             $this->children->add($child);
  120.             $child->setParent($this);
  121.         }
  122.         return $this;
  123.     }
  124.     public function removeChild(ForumReponse $child): self
  125.     {
  126.         if ($this->children->removeElement($child)) {
  127.             // set the owning side to null (unless already changed)
  128.             if ($child->getParent() === $this) {
  129.                 $child->setParent(null);
  130.             }
  131.         }
  132.         return $this;
  133.     }
  134.     public function __toString()
  135.     {
  136.         return "Autres Commentaire";
  137.     }
  138. }