createdAt = $now; $this->updatedAt = $now; if (null === $this->id) { $this->id = $this->generateCuid(); } } #[ORM\PreUpdate] public function setUpdatedAtValue(): void { $this->updatedAt = new DateTimeImmutable(); } public function getId(): ?string { return $this->id; } public function setId(string $id): static { $this->id = $id; return $this; } public function getName(): string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getFilename(): string { return $this->filename; } public function setFilename(string $filename): static { $this->filename = $filename; return $this; } public function getPath(): string { return $this->path; } public function setPath(string $path): static { $this->path = $path; return $this; } public function getMimeType(): string { return $this->mimeType; } public function setMimeType(string $mimeType): static { $this->mimeType = $mimeType; return $this; } public function getSize(): int { return $this->size; } public function setSize(int $size): static { $this->size = $size; return $this; } public function getMachine(): ?Machine { return $this->machine; } public function setMachine(?Machine $machine): static { $this->machine = $machine; return $this; } public function getComposant(): ?Composant { return $this->composant; } public function setComposant(?Composant $composant): static { $this->composant = $composant; return $this; } public function getPiece(): ?Piece { return $this->piece; } public function setPiece(?Piece $piece): static { $this->piece = $piece; return $this; } public function getProduct(): ?Product { return $this->product; } public function setProduct(?Product $product): static { $this->product = $product; return $this; } public function getSite(): ?Site { return $this->site; } public function setSite(?Site $site): static { $this->site = $site; return $this; } public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): DateTimeImmutable { return $this->updatedAt; } private function generateCuid(): string { return 'cl'.bin2hex(random_bytes(12)); } }