src/Entity/Server/Ticket/Ticket.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Server\Ticket;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Generic\User;
  5. use App\Repository\Server\Ticket\TicketRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  10. #[ORM\Entity(repositoryClassTicketRepository::class)]
  11. class Ticket extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\Column(type'guid'uniquetrue)]
  15.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  16.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  17.     private $id;
  18.     #[ORM\ManyToOne(inversedBy'tickets')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?User $creator null;
  21.     #[ORM\Column]
  22.     private ?bool $isAnswered null;
  23.     #[ORM\OneToMany(mappedBy'ticket'targetEntityTicketMessage::class)]
  24.     private Collection $ticketMessages;
  25.     #[ORM\Column(length255)]
  26.     private ?string $title null;
  27.     public function __construct()
  28.     {
  29.         parent::__construct();
  30.         $this->setIsAnswered(false);
  31.         $this->ticketMessages = new ArrayCollection();
  32.     }
  33.     public function getId(): ?string
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getCreator(): ?User
  38.     {
  39.         return $this->creator;
  40.     }
  41.     public function setCreator(?User $creator): static
  42.     {
  43.         $this->creator $creator;
  44.         return $this;
  45.     }
  46.     public function isIsAnswered(): ?bool
  47.     {
  48.         return $this->isAnswered;
  49.     }
  50.     public function setIsAnswered(bool $isAnswered): static
  51.     {
  52.         $this->isAnswered $isAnswered;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, TicketMessage>
  57.      */
  58.     public function getTicketMessages(): Collection
  59.     {
  60.         return $this->ticketMessages;
  61.     }
  62.     public function addTicketMessage(TicketMessage $ticketMessage): static
  63.     {
  64.         if (!$this->ticketMessages->contains($ticketMessage)) {
  65.             $this->ticketMessages->add($ticketMessage);
  66.             $ticketMessage->setTicket($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeTicketMessage(TicketMessage $ticketMessage): static
  71.     {
  72.         if ($this->ticketMessages->removeElement($ticketMessage)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($ticketMessage->getTicket() === $this) {
  75.                 $ticketMessage->setTicket(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function getTitle(): ?string
  81.     {
  82.         return $this->title;
  83.     }
  84.     public function setTitle(string $title): static
  85.     {
  86.         $this->title $title;
  87.         return $this;
  88.     }
  89. }