['post:collection:read', 'post:read']], )] #[GetCollection(normalizationContext: ['groups' => ['post:collection:read']])] class Post { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['post:collection:read'])] private ?int $id = null; #[ORM\Column] #[Groups(['post:collection:read'])] private ?\DateTimeImmutable $foundDate = null; #[ORM\Column] #[ApiProperty(writable: false)] #[Groups(['post:collection:read'])] private ?\DateTimeImmutable $publicationDate = null; #[ORM\Column(nullable: true)] #[Groups(['post:collection:read'])] private ?float $latitude = null; #[ORM\Column(nullable: true)] #[Groups(['post:collection:read'])] private ?float $longitude = null; #[ORM\Column(nullable: true)] #[Groups(['post:collection:read'])] private ?float $altitude = null; #[ORM\Column(type: Types::TEXT)] #[Groups(['post:read'])] private ?string $commentary = null; #[ORM\ManyToOne(inversedBy: 'posts')] #[ApiProperty(readableLink: false)] #[Groups(['post:collection:read'])] private ?Species $species = null; public function getId(): ?int { return $this->id; } public function getFoundDate(): ?\DateTimeImmutable { return $this->foundDate; } public function setFoundDate(\DateTimeImmutable $foundDate): static { $this->foundDate = $foundDate; return $this; } public function getPublicationDate(): ?\DateTimeImmutable { return $this->publicationDate; } public function setPublicationDate(\DateTimeImmutable $publicationDate): static { $this->publicationDate = $publicationDate; return $this; } public function getLatitude(): ?float { return $this->latitude; } public function setLatitude(?float $latitude): static { $this->latitude = $latitude; return $this; } public function getLongitude(): ?float { return $this->longitude; } public function setLongitude(?float $longitude): static { $this->longitude = $longitude; return $this; } public function getAltitude(): ?float { return $this->altitude; } public function setAltitude(?float $altitude): static { $this->altitude = $altitude; return $this; } public function getCommentary(): ?string { return $this->commentary; } public function setCommentary(string $commentary): static { $this->commentary = $commentary; return $this; } public function getSpecies(): ?Species { return $this->species; } public function setSpecies(?Species $species): static { $this->species = $species; return $this; } #[ORM\PrePersist] #[ORM\PreUpdate] public function setPublicationDateValue(): void { $this->publicationDate = new \DateTimeImmutable(); } }