Files
kupshop/bundles/KupShop/LLMBundle/Entity/TextPrompt.php
2025-08-02 16:30:27 +02:00

64 lines
1.2 KiB
PHP

<?php
namespace KupShop\LLMBundle\Entity;
class TextPrompt implements \ArrayAccess
{
protected ?int $id;
protected ?string $title;
protected ?string $user_text;
public function __construct(?string $title = null, ?string $userText = null)
{
$this->title = $title;
$this->user_text = $userText;
}
public function setId(?int $id): TextPrompt
{
$this->id = $id;
return $this;
}
public function getTitle(): string
{
return $this->title ?? '';
}
public function getId(): ?int
{
return $this->id;
}
public function getUserText(): ?string
{
return $this->user_text;
}
public function offsetExists(mixed $offset): bool
{
return isset($this->{$offset});
}
public function offsetGet(mixed $offset): mixed
{
return $this->{$offset};
}
public function offsetSet(mixed $offset, mixed $value): void
{
}
public function offsetUnset(mixed $offset): void
{
}
public static function fromArray(array $promptRow)
{
$entity = new self($promptRow['title'] ?? null, $promptRow['user_text'] ?? null);
return $entity->setId($promptRow['id'] ?? null);
}
}