<?phpnamespace App\Entity;use App\Repository\PostRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: PostRepository::class)]class Post{ #[ORM\Id] #[ORM\GeneratedValue(strategy: "IDENTITY")] #[ORM\Column(type: "integer")] private ?int $id = null; #[ORM\Column(type: "datetime")] private ?\DateTimeInterface $createdAt = null; #[ORM\Column(length: 100)] private ?string $title = null; #[ORM\Column(type: "text")] private ?string $body = null; #[ORM\Column(length: 50)] private ?string $genre = null; #[ORM\Column(length: 255, nullable: true)] private ?string $photo = null; #[Assert\Image(mimeTypes: ["image/jpeg", "image/png"])] private ?File $photoFile = null; #[ORM\Column(name: "epigraph", nullable: true)] private ?string $epigraph = null; public function getId(): ?int { return $this->id; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getBody(): ?string { return $this->body; } public function setBody(string $body): self { $this->body = $body; return $this; } public function getGenre(): ?string { return $this->genre; } public function setGenre(string $genre): self { $this->genre = $genre; return $this; } public static function createPost(string $title, string $body, string $genre): self { $post = new self(); $post->setTitle($title); $post->setBody($body); $post->setGenre($genre); $post->setCreatedAt(new \DateTime()); return $post; } public function getPhoto(): ?string { return $this->photo; } public function setPhoto(?string $photo): self { $this->photo = $photo; return $this; } public function getEpigraph(): ?string { return $this->epigraph; } public function setEpigraph(?string $epigraph): self { $this->epigraph = $epigraph; return $this; } public function getPhotoFile(): ?File { return $this->photoFile; } public function setPhotoFile(?File $photoFile): self { $this->photoFile = $photoFile; return $this; }}