src/Entity/Sujet.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Uid\Uuid;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\SujetRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. /**
  9.  * @ORM\Entity(repositoryClass=SujetRepository::class)
  10.  */
  11. class Sujet
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $uuid;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $token;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $nom;
  31.     /**
  32.      * @ORM\Column(type="integer", nullable=true)
  33.      */
  34.     private $reponse 1;
  35.     /**
  36.      * @ORM\Column(type="datetime_immutable", nullable=true)
  37.      */
  38.     private $createdAt;
  39.     /**
  40.      * @ORM\Column(type="datetime", nullable=true)
  41.      */
  42.     private $updatedAt;
  43.     /**
  44.      * @ORM\Column(type="boolean", nullable=true)
  45.      */
  46.     private $locked false;
  47.     public $last;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="sujets")
  50.      */
  51.     private $user;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=Message::class, mappedBy="sujet", cascade={"persist", "remove"})
  54.      */
  55.     private $messages;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $slug;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=Position::class, inversedBy="sujets")
  62.      */
  63.     private $position;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=Groupe::class, inversedBy="sujets")
  66.      */
  67.     private $groupe;
  68.     public function __construct()
  69.     {
  70.         $this->messages = new ArrayCollection();
  71.         $this->uuid Uuid::v4();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getUuid(): ?string
  78.     {
  79.         return $this->uuid;
  80.     }
  81.     public function setUuid(?string $uuid): self
  82.     {
  83.         $this->uuid $uuid;
  84.         return $this;
  85.     }
  86.     public function getToken(): ?string
  87.     {
  88.         return $this->token;
  89.     }
  90.     public function setToken(?string $token): self
  91.     {
  92.         $this->token $token;
  93.         return $this;
  94.     }
  95.     public function getNom(): ?string
  96.     {
  97.         return $this->nom;
  98.     }
  99.     public function setNom(?string $nom): self
  100.     {
  101.         $this->nom $nom;
  102.         return $this;
  103.     }
  104.     public function getReponse(): ?int
  105.     {
  106.         return $this->reponse;
  107.     }
  108.     public function setReponse(?int $reponse): self
  109.     {
  110.         $this->reponse $reponse;
  111.         return $this;
  112.     }
  113.     public function getCreatedAt(): ?\DateTimeImmutable
  114.     {
  115.         return $this->createdAt;
  116.     }
  117.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  118.     {
  119.         $this->createdAt $createdAt;
  120.         return $this;
  121.     }
  122.     public function getUpdatedAt(): ?\DateTimeInterface
  123.     {
  124.         return $this->updatedAt;
  125.     }
  126.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  127.     {
  128.         $this->updatedAt $updatedAt;
  129.         return $this;
  130.     }
  131.     public function isLocked(): ?bool
  132.     {
  133.         return $this->locked;
  134.     }
  135.     public function setLocked(?bool $locked): self
  136.     {
  137.         $this->locked $locked;
  138.         return $this;
  139.     }
  140.     public function getUser(): ?User
  141.     {
  142.         return $this->user;
  143.     }
  144.     public function setUser(?User $user): self
  145.     {
  146.         $this->user $user;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, Message>
  151.      */
  152.     public function getMessages(): Collection
  153.     {
  154.         return $this->messages;
  155.     }
  156.     public function addMessage(Message $message): self
  157.     {
  158.         if (!$this->messages->contains($message)) {
  159.             $this->messages[] = $message;
  160.             $message->setSujet($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeMessage(Message $message): self
  165.     {
  166.         if ($this->messages->removeElement($message)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($message->getSujet() === $this) {
  169.                 $message->setSujet(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     public function getSlug(): ?string
  175.     {
  176.         return $this->slug;
  177.     }
  178.     public function setSlug(?string $slug): self
  179.     {
  180.         $this->slug $slug;
  181.         return $this;
  182.     }
  183.     public function getPosition(): ?Position
  184.     {
  185.         return $this->position;
  186.     }
  187.     public function setPosition(?Position $position): self
  188.     {
  189.         $this->position $position;
  190.         return $this;
  191.     }
  192.     public function getGroupe(): ?Groupe
  193.     {
  194.         return $this->groupe;
  195.     }
  196.     public function setGroupe(?Groupe $groupe): self
  197.     {
  198.         $this->groupe $groupe;
  199.         return $this;
  200.     }
  201. }