id = Uuid::v4(); $this->version = $version; $this->content = $content; $this->comment = $comment; $this->active = $active; $this->createdAt = new \DateTimeImmutable(); } public function getId(): Uuid { return $this->id; } public function getVersion(): int { return $this->version; } public function getContent(): string { return $this->content; } public function getComment(): ?string { return $this->comment; } public function isActive(): bool { return $this->active; } public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function activate(): void { $this->active = true; $this->touch(); } public function deactivate(): void { $this->active = false; $this->touch(); } public function updateContent(string $content, ?string $comment = null): void { $this->content = $content; $this->comment = $comment; $this->touch(); } private function touch(): void { $this->updatedAt = new \DateTimeImmutable(); } }