src/Entity/GeoData.php line 42

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  4. use ApiPlatform\Metadata\ApiFilter;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Serializer\Filter\PropertyFilter;
  9. use App\Repository\GeoDataRepository;
  10. use DateTimeImmutable;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. #[ORM\Entity(repositoryClassGeoDataRepository::class)]
  14. #[ApiFilter(PropertyFilter::class)]
  15. /*#[ApiResource(
  16.     shortName: 'Studio Geo',
  17.     description: 'Api Studio Geodaten.',
  18.     operations: [
  19.         new Get(uriTemplate: '/studio-geo/{id}'),
  20.         new GetCollection(uriTemplate: '/studio-geo', paginationEnabled: false),
  21.         //new Post(uriTemplate: '/set-media-category'),
  22.         //new Patch(uriTemplate: '/update-media-category/{id}'),
  23.     ],
  24.     formats: [
  25.         'jsonld',
  26.         'json',
  27.         'jsonhal',
  28.         'csv' => 'text/csv',
  29.     ],
  30.     normalizationContext: [
  31.         'groups' => ['geo:read'],
  32.     ],
  33.     denormalizationContext: [
  34.         'groups' => ['geo:write'],
  35.     ],
  36.     //paginationItemsPerPage: 10,
  37. )]*/
  38. class GeoData
  39. {
  40.     #[ORM\Id]
  41.     #[ORM\GeneratedValue]
  42.     #[ORM\Column]
  43.     #[Groups(['geo:read'])]
  44.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  45.     private ?int $id null;
  46.     #[ORM\Column(length255nullabletrue)]
  47.     #[Groups(['geo:read' ,'studio:read'])]
  48.     private ?string $geoLon null;
  49.     #[ORM\Column(length255nullabletrue)]
  50.     #[Groups(['geo:read' ,'studio:read'])]
  51.     private ?string $geoLat null;
  52.     #[ORM\Column(nullabletrue)]
  53.     #[Groups(['geo:read' ,'studio:read'])]
  54.     private array $geoJson = [];
  55.     #[Groups(['geo:read'])]
  56.     #[ORM\OneToOne(mappedBy'geodaten'targetEntityStudio::class)]
  57.     protected Studio $studio;
  58.     #[ORM\Column]
  59.     private ?DateTimeImmutable $createdAt null;
  60.     #[ORM\Column(length255nullabletrue)]
  61.     #[Groups(['geo:read' ,'studio:read'])]
  62.     private ?string $displayName null;
  63.     #[ORM\Column(nullabletrue)]
  64.     #[Groups(['geo:read' ,'studio:read'])]
  65.     private array $boundingBox = [];
  66.     #[ORM\Column(length255nullabletrue)]
  67.     #[Groups(['geo:read' ,'studio:read'])]
  68.     private ?string $importance null;
  69.     #[ORM\Column(nullabletrue)]
  70.     #[Groups(['geo:read' ,'studio:read'])]
  71.     private ?string $osmId null;
  72.     #[ORM\Column(nullabletrue)]
  73.     #[Groups(['geo:read' ,'studio:read'])]
  74.     private ?string $placeId null;
  75.     #[ORM\Column(length64nullabletrue)]
  76.     #[Groups(['geo:read' ,'studio:read'])]
  77.     private ?string $osmType null;
  78.     public function __construct()
  79.     {
  80.         $this->createdAt = new DateTimeImmutable();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getGeoLon(): ?string
  87.     {
  88.         return $this->geoLon;
  89.     }
  90.     public function setGeoLon(?string $geoLon): self
  91.     {
  92.         $this->geoLon $geoLon;
  93.         return $this;
  94.     }
  95.     public function getGeoLat(): ?string
  96.     {
  97.         return $this->geoLat;
  98.     }
  99.     public function setGeoLat(?string $geoLat): self
  100.     {
  101.         $this->geoLat $geoLat;
  102.         return $this;
  103.     }
  104.     public function getGeoJson(): array
  105.     {
  106.         return $this->geoJson;
  107.     }
  108.     public function setGeoJson(?array $geoJson): self
  109.     {
  110.         $this->geoJson $geoJson;
  111.         return $this;
  112.     }
  113.     public function getCreatedAt(): ?DateTimeImmutable
  114.     {
  115.         return $this->createdAt;
  116.     }
  117.     public function setCreatedAt(DateTimeImmutable $createdAt): self
  118.     {
  119.         $this->createdAt $createdAt;
  120.         return $this;
  121.     }
  122.     public function getStudio(): ?Studio
  123.     {
  124.         return $this->studio;
  125.     }
  126.     public function setStudio(?Studio $studio): self
  127.     {
  128.         // unset the owning side of the relation if necessary
  129.         if ($studio === null && $this->studio !== null) {
  130.             $this->studio->setGeodaten(null);
  131.         }
  132.         // set the owning side of the relation if necessary
  133.         if ($studio !== null && $studio->getGeodaten() !== $this) {
  134.             $studio->setGeodaten($this);
  135.         }
  136.         $this->studio $studio;
  137.         return $this;
  138.     }
  139.     public function getDisplayName(): ?string
  140.     {
  141.         return $this->displayName;
  142.     }
  143.     public function setDisplayName(?string $displayName): self
  144.     {
  145.         $this->displayName $displayName;
  146.         return $this;
  147.     }
  148.     public function getBoundingBox(): array
  149.     {
  150.         return $this->boundingBox;
  151.     }
  152.     public function setBoundingBox(?array $boundingBox): self
  153.     {
  154.         $this->boundingBox $boundingBox;
  155.         return $this;
  156.     }
  157.     public function getImportance(): ?string
  158.     {
  159.         return $this->importance;
  160.     }
  161.     public function setImportance(?string $importance): self
  162.     {
  163.         $this->importance $importance;
  164.         return $this;
  165.     }
  166.     public function getOsmId(): ?string
  167.     {
  168.         return $this->osmId;
  169.     }
  170.     public function setOsmId(?string $osmId): self
  171.     {
  172.         $this->osmId $osmId;
  173.         return $this;
  174.     }
  175.     public function getPlaceId(): ?string
  176.     {
  177.         return $this->placeId;
  178.     }
  179.     public function setPlaceId(string $placeId): self
  180.     {
  181.         $this->placeId $placeId;
  182.         return $this;
  183.     }
  184.     public function getOsmType(): ?string
  185.     {
  186.         return $this->osmType;
  187.     }
  188.     public function setOsmType(?string $osmType): self
  189.     {
  190.         $this->osmType $osmType;
  191.         return $this;
  192.     }
  193. }