src/Entity/Conversation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ConversationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Uid\Uuid;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ConversationRepository::class)
  10.  */
  11. class Conversation
  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 $slug;
  31.     /**
  32.      * @ORM\Column(type="boolean", nullable=true)
  33.      */
  34.     private $statut false;
  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\ManyToOne(targetEntity=User::class, inversedBy="conversations")
  45.      */
  46.     private $interlocuteur;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $genre;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=Post::class, inversedBy="conversations")
  53.      */
  54.     private $post;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity=Agora::class, inversedBy="conversations")
  57.      */
  58.     private $agora;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=Messagerie::class, mappedBy="conversation")
  61.      */
  62.     private $messageries;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="conversationsUser")
  65.      */
  66.     private $user;
  67.     public function __construct()
  68.     {
  69.         $this->uuid Uuid::v4();
  70.         $this->messageries = new ArrayCollection();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getUuid(): ?string
  77.     {
  78.         return $this->uuid;
  79.     }
  80.     public function setUuid(?string $uuid): self
  81.     {
  82.         $this->uuid $uuid;
  83.         return $this;
  84.     }
  85.     public function getToken(): ?string
  86.     {
  87.         return $this->token;
  88.     }
  89.     public function setToken(?string $token): self
  90.     {
  91.         $this->token $token;
  92.         return $this;
  93.     }
  94.     public function getSlug(): ?string
  95.     {
  96.         return $this->slug;
  97.     }
  98.     public function setSlug(?string $slug): self
  99.     {
  100.         $this->slug $slug;
  101.         return $this;
  102.     }
  103.     public function isStatut(): ?bool
  104.     {
  105.         return $this->statut;
  106.     }
  107.     public function setStatut(?bool $statut): self
  108.     {
  109.         $this->statut $statut;
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeImmutable
  113.     {
  114.         return $this->createdAt;
  115.     }
  116.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  117.     {
  118.         $this->createdAt $createdAt;
  119.         return $this;
  120.     }
  121.     public function getUpdatedAt(): ?\DateTimeInterface
  122.     {
  123.         return $this->updatedAt;
  124.     }
  125.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  126.     {
  127.         $this->updatedAt $updatedAt;
  128.         return $this;
  129.     }
  130.     public function getInterlocuteur(): ?User
  131.     {
  132.         return $this->interlocuteur;
  133.     }
  134.     public function setInterlocuteur(?User $interlocuteur): self
  135.     {
  136.         $this->interlocuteur $interlocuteur;
  137.         return $this;
  138.     }
  139.     public function getGenre(): ?string
  140.     {
  141.         return $this->genre;
  142.     }
  143.     public function setGenre(?string $genre): self
  144.     {
  145.         $this->genre $genre;
  146.         return $this;
  147.     }
  148.     public function getPost(): ?Post
  149.     {
  150.         return $this->post;
  151.     }
  152.     public function setPost(?Post $post): self
  153.     {
  154.         $this->post $post;
  155.         return $this;
  156.     }
  157.     public function getAgora(): ?Agora
  158.     {
  159.         return $this->agora;
  160.     }
  161.     public function setAgora(?Agora $agora): self
  162.     {
  163.         $this->agora $agora;
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection<int, Messagerie>
  168.      */
  169.     public function getMessageries(): Collection
  170.     {
  171.         return $this->messageries;
  172.     }
  173.     public function addMessagery(Messagerie $messagery): self
  174.     {
  175.         if (!$this->messageries->contains($messagery)) {
  176.             $this->messageries[] = $messagery;
  177.             $messagery->setConversation($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeMessagery(Messagerie $messagery): self
  182.     {
  183.         if ($this->messageries->removeElement($messagery)) {
  184.             // set the owning side to null (unless already changed)
  185.             if ($messagery->getConversation() === $this) {
  186.                 $messagery->setConversation(null);
  187.             }
  188.         }
  189.         return $this;
  190.     }
  191.     public function getUser(): ?User
  192.     {
  193.         return $this->user;
  194.     }
  195.     public function setUser(?User $user): self
  196.     {
  197.         $this->user $user;
  198.         return $this;
  199.     }
  200. }