|null */ #[ORM\Column(type: 'json', nullable: true)] private ?array $context = []; /** * @var array|null */ #[ORM\Column(type: 'json', nullable: true)] private ?array $extra = []; #[ORM\Column(type: 'datetime_immutable')] private \DateTimeImmutable $createdAt; #[ORM\Column(type: 'string', length: 12, nullable: true)] private ?string $errorCode = null; 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; } /** * @return array|null */ public function getContext(): ?array { return $this->context; } /** * @param array|null $context */ public function setContext(?array $context): self { $this->context = $context; return $this; } /** * @return array|null */ public function getExtra(): ?array { return $this->extra; } /** * @param array|null $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 getUsername(): string { return $this->getExtra()['user']['username'] ?? ''; } public function getRequestId(): string { return $this->getExtra()['request_id'] ?? '-'; } public function getErrorCode(): ?string { return $this->errorCode; } public function setErrorCode(?string $errorCode): self { $this->errorCode = $errorCode; return $this; } public function getUri(): string { return $this->getExtra()['uri'] ?? ''; } }