src/Entity/ThreadAiRequest.php line 19

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\ThreadAiRequestRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassThreadAiRequestRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['read','thread_ai_request','read_here_only']],
  13.     denormalizationContext: ['groups' => ['write']],
  14.     
  15.     )]
  16. class ThreadAiRequest
  17. {
  18.     #[Groups(['read'])]
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[Groups(['read''write'])]
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  25.     private ?\DateTimeInterface $createdAt null;
  26.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  27.     private ?string $description null;
  28.     #[Groups(['write','thread_ai_request','read_here_only'])]
  29.     #[ORM\OneToMany(mappedBy'threadAiRequest'targetEntityAiRequest::class,cascade:["persist","remove"])]
  30.     private Collection $aiRequests;
  31.     #[Groups(['read''write'])]
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $namespace null;
  34.     #[Groups(['read''write'])]
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $entity null;
  37.     #[Groups(['read''write'])]
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $action null;
  40.     #[Groups(['read''write'])]
  41.     #[ORM\Column(length255nullabletrue)]
  42.     private ?string $status null;
  43.     public function __construct()
  44.     {
  45.         $this->aiRequests = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getCreatedAt(): ?\DateTimeInterface
  52.     {
  53.         return $this->createdAt;
  54.     }
  55.     public function setCreatedAt(?\DateTimeInterface $createdAt): static
  56.     {
  57.         $this->createdAt $createdAt;
  58.         return $this;
  59.     }
  60.     public function getDescription(): ?string
  61.     {
  62.         return $this->description;
  63.     }
  64.     public function setDescription(?string $description): static
  65.     {
  66.         $this->description $description;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection<int, AiRequest>
  71.      */
  72.     #[Groups(['thread_ai_request'])]
  73.     public function getAiRequests(): Collection
  74.     {
  75.         return $this->aiRequests;
  76.     }
  77.     public function addAiRequest(AiRequest $aiRequest): static
  78.     {
  79.         if (!$this->aiRequests->contains($aiRequest)) {
  80.             $this->aiRequests->add($aiRequest);
  81.             $aiRequest->setThreadAiRequest($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeAiRequest(AiRequest $aiRequest): static
  86.     {
  87.         if ($this->aiRequests->removeElement($aiRequest)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($aiRequest->getThreadAiRequest() === $this) {
  90.                 $aiRequest->setThreadAiRequest(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95.     public function getNamespace(): ?string
  96.     {
  97.         return $this->namespace;
  98.     }
  99.     public function setNamespace(?string $namespace): static
  100.     {
  101.         $this->namespace $namespace;
  102.         return $this;
  103.     }
  104.     public function getEntity(): ?string
  105.     {
  106.         return $this->entity;
  107.     }
  108.     public function setEntity(?string $entity): static
  109.     {
  110.         $this->entity $entity;
  111.         return $this;
  112.     }
  113.     public function getAction(): ?string
  114.     {
  115.         return $this->action;
  116.     }
  117.     public function setAction(?string $action): static
  118.     {
  119.         $this->action $action;
  120.         return $this;
  121.     }
  122.     public function getStatus(): ?string
  123.     {
  124.         return $this->status;
  125.     }
  126.     public function setStatus(?string $status): static
  127.     {
  128.         $this->status $status;
  129.         return $this;
  130.     }
  131. }