Initial commit

This commit is contained in:
2024-11-13 19:34:30 +01:00
parent 53b43eddb1
commit 015fc0ea94
16 changed files with 2164 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Controller;
use App\Entity\Site;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
class SiteController extends AbstractController
{
#[Route('/site/{id<\d+>}', name: 'app_site')]
public function index(Site $site): JsonResponse
{
return $this->json([
'message' => 'Request successful',
'site' => $site,
]);
}
}

0
src/Entity/.gitignore vendored Normal file
View File

339
src/Entity/Site.php Normal file
View File

@@ -0,0 +1,339 @@
<?php
namespace App\Entity;
use App\Repository\SiteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use \JsonSerializable;
#[ORM\Entity(repositoryClass: SiteRepository::class)]
#[ORM\Table(name: 'sito')]
class Site implements JsonSerializable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(name: 'localita', length: 255, nullable: true)]
private ?string $place = null;
#[ORM\Column(name: 'indirizzo', type: Types::TEXT, nullable: true)]
private ?string $address = null;
#[ORM\Column(name: 'comune', length: 30)]
private ?string $municipality = null;
#[ORM\Column(name: 'localizzazione', type: Types::TEXT, nullable: true)]
private ?string $localization = null;
#[ORM\Column(name: 'denominazione', type: Types::TEXT, nullable: true)]
private ?string $denomination = null;
#[ORM\Column(name: 'definizione', length: 255, nullable: true)]
private ?string $definition = null;
#[ORM\Column(name: 'periodo', length: 255, nullable: true)]
private ?string $period = null;
#[ORM\Column(name: 'fase', length: 255, nullable: true)]
private ?string $phase = null;
#[ORM\Column(name: 'cronologia', length: 255, nullable: true)]
private ?string $chronology = null;
#[ORM\Column(name: 'motivazione_cron', length: 255, nullable: true)]
private ?string $chronologyMotivation = null;
#[ORM\Column(name: 'descrizione', type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(name: 'ritrovamento', length: 255, nullable: true)]
private ?string $finding = null;
#[ORM\Column(name: 'materiali_rinv', length: 255, nullable: true)]
private ?string $materials = null;
#[ORM\Column(name: 'luogo_custodia_mat', type: Types::TEXT, nullable: true)]
private ?string $conservationPlace = null;
#[ORM\Column(name: 'proprietà', length: 255, nullable: true)]
private ?string $ownedBy = null;
#[ORM\Column(name: 'gis_id', length: 20)]
private ?string $gisId = null;
#[ORM\Column(name: 'stato_conserv', length: 255, nullable: true)]
private ?string $conservationState = null;
#[ORM\Column(name: 'desc_breve', length: 255, nullable: true)]
private ?string $shortDescription = null;
#[ORM\Column(name: 'loc_generica', length: 200, nullable: true)]
private ?string $genericPlace = null;
public function getId(): ?int
{
return $this->id;
}
public function setId(string $id): static
{
$this->id = $id;
return $this;
}
public function getPlace(): ?string
{
return $this->place;
}
public function setPlace(?string $place): static
{
$this->place = $place;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): static
{
$this->address = $address;
return $this;
}
public function getMunicipality(): ?string
{
return $this->municipality;
}
public function setMunicipality(string $municipality): static
{
$this->municipality = $municipality;
return $this;
}
public function getLocalization(): ?string
{
return $this->localization;
}
public function setLocalization(?string $localization): static
{
$this->localization = $localization;
return $this;
}
public function getDenomination(): ?string
{
return $this->denomination;
}
public function setDenomination(?string $denomination): static
{
$this->denomination = $denomination;
return $this;
}
public function getDefinition(): ?string
{
return $this->definition;
}
public function setDefinition(?string $definition): static
{
$this->definition = $definition;
return $this;
}
public function getPeriod(): ?string
{
return $this->period;
}
public function setPeriod(?string $period): static
{
$this->period = $period;
return $this;
}
public function getPhase(): ?string
{
return $this->phase;
}
public function setPhase(?string $phase): static
{
$this->phase = $phase;
return $this;
}
public function getChronology(): ?string
{
return $this->chronology;
}
public function setChronology(?string $chronology): static
{
$this->chronology = $chronology;
return $this;
}
public function getChronologyMotivation(): ?string
{
return $this->chronologyMotivation;
}
public function setChronologyMotivation(?string $chronologyMotivation): static
{
$this->chronologyMotivation = $chronologyMotivation;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getFinding(): ?string
{
return $this->finding;
}
public function setFinding(?string $finding): static
{
$this->finding = $finding;
return $this;
}
public function getMaterials(): ?string
{
return $this->materials;
}
public function setMaterials(?string $materials): static
{
$this->materials = $materials;
return $this;
}
public function getConservationPlace(): ?string
{
return $this->conservationPlace;
}
public function setConservationPlace(?string $conservationPlace): static
{
$this->conservationPlace = $conservationPlace;
return $this;
}
public function getOwnedBy(): ?string
{
return $this->ownedBy;
}
public function setOwnedBy(?string $ownedBy): static
{
$this->ownedBy = $ownedBy;
return $this;
}
public function getGisId(): ?string
{
return $this->gisId;
}
public function setGisId(string $gisId): static
{
$this->gisId = $gisId;
return $this;
}
public function getConservationState(): ?string
{
return $this->conservationState;
}
public function setConservationState(?string $conservationState): static
{
$this->conservationState = $conservationState;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(?string $shortDescription): static
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getGenericPlace(): ?string
{
return $this->genericPlace;
}
public function setGenericPlace(?string $genericPlace): static
{
$this->genericPlace = $genericPlace;
return $this;
}
public function jsonSerialize(): array
{
return [
'gisId' => $this->gisId,
'place' => $this->place,
'genericPlace' => $this->genericPlace,
'address' => $this->address,
'localization' => $this->localization,
'denomination' => $this->denomination,
'definition' => $this->definition,
'period' => $this->period,
'phase' => $this->phase,
'chronology' => $this->chronology,
'motivation' => $this->chronologyMotivation,
'finding' => $this->finding,
'materials' => $this->materials,
'conservationState' => $this->conservationState,
'conservationPlace' => $this->conservationPlace,
'description' => $this->description,
'shortDescription' => $this->shortDescription,
'ownedBy' => $this->ownedBy,
];
}
}

0
src/Repository/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Site;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Site>
*/
class SiteRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Site::class);
}
// /**
// * @return Site[] Returns an array of Site objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Site
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}