entityType = $entityType; $this->entityId = $entityId; $this->action = $action; $this->diff = $diff; $this->snapshot = $snapshot; $this->actorProfileId = $actorProfileId; } #[ORM\PrePersist] public function initializeAuditLog(): void { if (!isset($this->createdAt)) { $this->createdAt = new DateTimeImmutable(); } if (null === $this->id) { $this->id = $this->generateCuid(); } } public function getId(): ?string { return $this->id; } public function getEntityType(): string { return $this->entityType; } public function getEntityId(): string { return $this->entityId; } public function getAction(): string { return $this->action; } public function getDiff(): ?array { return $this->diff; } public function getSnapshot(): ?array { return $this->snapshot; } public function getActorProfileId(): ?string { return $this->actorProfileId; } public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } private function generateCuid(): string { // Keep the same lightweight CUID-like strategy used across the project. return 'cl'.substr(strtolower(base_convert(bin2hex(random_bytes(12)), 16, 36)), 0, 24); } }