id = new Id(); $this->type = $type; $this->status = $status; $this->title = $title; $this->description = new Description(); $this->template = new Template(); $this->image = new Image(); $this->color = new Color(); $this->createdAt = new DateTime(); } public function getId(): Id { return $this->id; } public function getType(): Type { return $this->type; } public function getStatus(): Status { return $this->status; } public function setStatus(Status $status): self { $this->status = $status; return $this; } public function getTitle(): Title { return $this->title; } public function setTitle(Title $title): self { $this->title = $title; return $this; } public function getDescription(): Description { return $this->description; } public function setDescription(Description $description): self { $this->description = $description; return $this; } public function getTemplate(): Template { return $this->template; } public function setTemplate(Template $template): self { if ($this->isLocked) { throw new LockedPresetException(); } $this->template = $template; return $this; } public function getImage(): Image { return $this->image; } public function setImage(Image $image): self { $this->image = $image; return $this; } public function getColor(): Color { return $this->color; } public function setColor(Color $color): self { $this->color = $color; return $this; } public function getCreatedAt(): DateTimeInterface { return $this->createdAt; } public function getUpdatedAt(): ?DateTimeInterface { return $this->updatedAt; } public function getCategory(): ?CategoryEntity { return $this->category; } public function setCategory(?CategoryEntity $category): self { $this->category = $category; return $this; } /** * Locked presets' template and settings cannot be modified. * Once a preset is locked, it cannot be unlocked. * * @return void */ public function lock(): void { $this->isLocked = true; } public function isLocked(): bool { return $this->isLocked; } #[ORM\PreUpdate] public function preUpdate(): void { $this->updatedAt = new DateTime(); } }