src/Entity/ThreadAiRequest.php line 19
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\ThreadAiRequestRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: ThreadAiRequestRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['read','thread_ai_request','read_here_only']],
denormalizationContext: ['groups' => ['write']],
)]
class ThreadAiRequest
{
#[Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['read', 'write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[Groups(['write','thread_ai_request','read_here_only'])]
#[ORM\OneToMany(mappedBy: 'threadAiRequest', targetEntity: AiRequest::class,cascade:["persist","remove"])]
private Collection $aiRequests;
#[Groups(['read', 'write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $namespace = null;
#[Groups(['read', 'write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $entity = null;
#[Groups(['read', 'write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $action = null;
#[Groups(['read', 'write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $status = null;
public function __construct()
{
$this->aiRequests = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, AiRequest>
*/
#[Groups(['thread_ai_request'])]
public function getAiRequests(): Collection
{
return $this->aiRequests;
}
public function addAiRequest(AiRequest $aiRequest): static
{
if (!$this->aiRequests->contains($aiRequest)) {
$this->aiRequests->add($aiRequest);
$aiRequest->setThreadAiRequest($this);
}
return $this;
}
public function removeAiRequest(AiRequest $aiRequest): static
{
if ($this->aiRequests->removeElement($aiRequest)) {
// set the owning side to null (unless already changed)
if ($aiRequest->getThreadAiRequest() === $this) {
$aiRequest->setThreadAiRequest(null);
}
}
return $this;
}
public function getNamespace(): ?string
{
return $this->namespace;
}
public function setNamespace(?string $namespace): static
{
$this->namespace = $namespace;
return $this;
}
public function getEntity(): ?string
{
return $this->entity;
}
public function setEntity(?string $entity): static
{
$this->entity = $entity;
return $this;
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(?string $action): static
{
$this->action = $action;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): static
{
$this->status = $status;
return $this;
}
}