['spot:read']], order: ['name' => 'ASC'], paginationEnabled: false, )] class CoastalPoint { #[ORM\Id] #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[Groups(['spot:read'])] private ?Uuid $id = null; #[ORM\Column(length: 150)] #[Groups(['spot:read'])] private string $name; #[ORM\Column(type: 'geometry', options: ['geometry_type' => 'POINT', 'srid' => 4326])] private mixed $geometry = null; #[ORM\Column(length: 30)] #[Groups(['spot:read'])] private string $type; #[ORM\Column(length: 100)] #[Groups(['spot:read'])] private string $region; #[ORM\Column(length: 30, nullable: true, unique: true)] private ?string $osmId = null; /** @var Collection */ #[ORM\OneToMany(targetEntity: ImpactScore::class, mappedBy: 'coastalPoint')] private Collection $impactScores; /** @var Collection */ #[ORM\OneToMany(targetEntity: UserFeedback::class, mappedBy: 'coastalPoint')] private Collection $feedbacks; public function __construct() { $this->name = ''; $this->type = ''; $this->region = ''; $this->impactScores = new ArrayCollection(); $this->feedbacks = new ArrayCollection(); } public function getId(): ?Uuid { return $this->id; } public function getName(): string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getGeometry(): mixed { return $this->geometry; } public function setGeometry(mixed $geometry): static { $this->geometry = $geometry; return $this; } #[Groups(['spot:read'])] public function getLongitude(): ?float { if ($this->geometry === null) return null; preg_match('/POINT\(([^ ]+) /', (string) $this->geometry, $m); return isset($m[1]) ? (float) $m[1] : null; } #[Groups(['spot:read'])] public function getLatitude(): ?float { if ($this->geometry === null) return null; preg_match('/POINT\([^ ]+ ([^)]+)\)/', (string) $this->geometry, $m); return isset($m[1]) ? (float) $m[1] : null; } public function getType(): string { return $this->type; } public function setType(string $type): static { $this->type = $type; return $this; } public function getRegion(): string { return $this->region; } public function setRegion(string $region): static { $this->region = $region; return $this; } public function getOsmId(): ?string { return $this->osmId; } public function setOsmId(?string $osmId): static { $this->osmId = $osmId; return $this; } /** @return Collection */ public function getImpactScores(): Collection { return $this->impactScores; } /** @return Collection */ public function getFeedbacks(): Collection { return $this->feedbacks; } }