src/Entity/Ticket.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TicketRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassTicketRepository::class)]
  9. class Ticket
  10. {
  11.     public const TO_PROCESS 1;
  12.     public const FINISHED 2;
  13.     public const CANCELED 3;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $title null;
  20.     #[ORM\Column(typeTypes::TEXT)]
  21.     private ?string $description null;
  22.     #[ORM\Column]
  23.     private ?\DateTimeImmutable $addedAt null;
  24.     #[ORM\Column(nullabletrue)]
  25.     private ?\DateTimeImmutable $updatedAt null;
  26.     #[ORM\Column]
  27.     private ?int $isActive 1;
  28.     #[ORM\OneToMany(mappedBy'ticket'targetEntityChat::class)]
  29.     private Collection $chat;
  30.     #[ORM\Column]
  31.     private ?int $status 1;
  32.     #[ORM\ManyToOne(inversedBy'ticket')]
  33.     private ?User $user null;
  34.     public function __construct()
  35.     {
  36.         $this->setAddedAt(new \DateTimeImmutable());
  37.         $this->chat = new ArrayCollection();
  38.     }
  39.     public function __toString(): string
  40.     {
  41.         return $this->title;
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getTitle(): ?string
  48.     {
  49.         return $this->title;
  50.     }
  51.     public function setTitle(string $title): self
  52.     {
  53.         $this->title $title;
  54.         return $this;
  55.     }
  56.     public function getDescription(): ?string
  57.     {
  58.         return $this->description;
  59.     }
  60.     public function setDescription(string $description): self
  61.     {
  62.         $this->description $description;
  63.         return $this;
  64.     }
  65.     public function getAddedAt(): ?\DateTimeImmutable
  66.     {
  67.         return $this->addedAt;
  68.     }
  69.     public function setAddedAt(\DateTimeImmutable $addedAt): self
  70.     {
  71.         $this->addedAt $addedAt;
  72.         return $this;
  73.     }
  74.     public function getUpdatedAt(): ?\DateTimeImmutable
  75.     {
  76.         return $this->updatedAt;
  77.     }
  78.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  79.     {
  80.         $this->updatedAt $updatedAt;
  81.         return $this;
  82.     }
  83.     public function getIsActive(): ?int
  84.     {
  85.         return $this->isActive;
  86.     }
  87.     public function setIsActive(int $isActive): self
  88.     {
  89.         $this->isActive $isActive;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection<int, Chat>
  94.      */
  95.     public function getChat(): Collection
  96.     {
  97.         return $this->chat;
  98.     }
  99.     public function addChat(Chat $chat): self
  100.     {
  101.         if (!$this->chat->contains($chat)) {
  102.             $this->chat->add($chat);
  103.             $chat->setTicket($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeChat(Chat $chat): self
  108.     {
  109.         if ($this->chat->removeElement($chat)) {
  110.             // set the owning side to null (unless already changed)
  111.             if ($chat->getTicket() === $this) {
  112.                 $chat->setTicket(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117.     public function getStatus(): ?int
  118.     {
  119.         return $this->status;
  120.     }
  121.     public function setStatus(int $status): self
  122.     {
  123.         $this->status $status;
  124.         return $this;
  125.     }
  126.     public function getUser(): ?User
  127.     {
  128.         return $this->user;
  129.     }
  130.     public function setUser(?User $user): self
  131.     {
  132.         $this->user $user;
  133.         return $this;
  134.     }
  135. }