105 lines
2.0 KiB
PHP
105 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\LogEntryRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: LogEntryRepository::class)]
|
|
class LogEntry
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column(type: 'integer')]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(type: 'string', length: 255)]
|
|
private ?string $channel;
|
|
|
|
#[ORM\Column(type: 'string', length: 255)]
|
|
private ?string $message;
|
|
|
|
#[ORM\Column(type: 'json', nullable: true)]
|
|
private ?array $context = [];
|
|
|
|
#[ORM\Column(type: 'json', nullable: true)]
|
|
private ?array $extra = [];
|
|
|
|
#[ORM\Column(type: 'datetime_immutable')]
|
|
private \DateTimeImmutable $createdAt;
|
|
|
|
public function __construct(string $channel, string $message)
|
|
{
|
|
$this->channel = $channel;
|
|
$this->message = $message;
|
|
$this->createdAt = new \DateTimeImmutable('now');
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getMessage(): ?string
|
|
{
|
|
return $this->message;
|
|
}
|
|
|
|
public function setMessage(string $message): self
|
|
{
|
|
$this->message = $message;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getChannel(): ?string
|
|
{
|
|
return $this->channel;
|
|
}
|
|
|
|
public function setChannel(?string $channel): self
|
|
{
|
|
$this->channel = $channel;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getContext(): ?array
|
|
{
|
|
return $this->context;
|
|
}
|
|
|
|
public function setContext(?array $context): self
|
|
{
|
|
$this->context = $context;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getExtra(): ?array
|
|
{
|
|
return $this->extra;
|
|
}
|
|
|
|
public function setExtra(?array $extra): self
|
|
{
|
|
$this->extra = $extra;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function setCreatedAt(\DateTimeImmutable $createdAt): self
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
|
|
return $this;
|
|
}
|
|
}
|