<?php
namespace PaperKite\Log\Entity;
use DateTimeImmutable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use PaperKite\Log\Repository\AuditLogRepository;
#[ORM\Entity(repositoryClass: AuditLogRepository::class)]
class AuditLog
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $message = null;
#[ORM\Column(type: Types::JSON)]
private array $context = [];
#[ORM\Column(type: Types::SMALLINT)]
private ?int $level = null;
#[ORM\Column(length: 50)]
private ?string $levelName = null;
#[ORM\Column(length: 255)]
private ?string $channel = null;
#[ORM\Column(type: Types::JSON)]
private array $extra = [];
#[ORM\Column]
private ?DateTimeImmutable $createdAt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $user = null;
public function __construct()
{
$this->createdAt = new DateTimeImmutable();
}
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 getContext(): array
{
return $this->context;
}
public function setContext(array $context): self
{
$this->context = $context;
return $this;
}
public function getLevel(): ?int
{
return $this->level;
}
public function setLevel(int $level): self
{
$this->level = $level;
return $this;
}
public function getLevelName(): ?string
{
return $this->levelName;
}
public function setLevelName(string $levelName): self
{
$this->levelName = $levelName;
return $this;
}
public function getChannel(): ?string
{
return $this->channel;
}
public function setChannel(string $channel): self
{
$this->channel = $channel;
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;
}
public function getUser(): ?string
{
return $this->user;
}
public function setUser(?string $user): self
{
$this->user = $user;
return $this;
}
}