Add image entity

This commit is contained in:
2024-11-15 10:02:58 +01:00
parent 325e255d75
commit b1c9fdbdf7
6 changed files with 256 additions and 14 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Entity;
use App\Repository\SiteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use \JsonSerializable;
@@ -73,6 +74,12 @@ class Site implements JsonSerializable
#[ORM\Column(name: 'loc_generica', length: 200, nullable: true)]
private ?string $genericPlace = null;
private ?float $lat;
private ?float $lng;
private ?ArrayCollection $images;
public function getId(): ?int
{
return $this->id;
@@ -313,6 +320,40 @@ class Site implements JsonSerializable
return $this;
}
public function getLat(): ?float
{
return $this->lat;
}
public function setLat(float $lat): static
{
$this->lat = $lat;
return $this;
}
public function getLng(): ?float
{
return $this->lng;
}
public function setLng(float $lng): static
{
$this->lng = $lng;
return $this;
}
public function getImages(): ?ArrayCollection
{
return $this->images;
}
public function setImages(ArrayCollection $images): static
{
$this->images = $images;
return $this;
}
public function jsonSerialize(): array
{
return [
@@ -321,6 +362,7 @@ class Site implements JsonSerializable
'genericPlace' => $this->genericPlace,
'address' => $this->address,
'localization' => $this->localization,
'coordinates' => [$this->lat, $this->lng],
'denomination' => $this->denomination,
'definition' => $this->definition,
'period' => $this->period,
@@ -334,6 +376,7 @@ class Site implements JsonSerializable
'description' => $this->description,
'shortDescription' => $this->shortDescription,
'ownedBy' => $this->ownedBy,
'images' => $this->images->toArray(),
];
}
}