Initial commit
This commit is contained in:
parent
53b43eddb1
commit
015fc0ea94
10
.env
10
.env
@ -18,3 +18,13 @@
|
||||
APP_ENV=dev
|
||||
APP_SECRET=0c1e9f778b4c265fa58349c469f9abd8
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
###> doctrine/doctrine-bundle ###
|
||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||
#
|
||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,7 @@
|
||||
.ddev
|
||||
.vscode
|
||||
|
||||
*.sql*
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
/.env.local
|
||||
|
7
compose.override.yaml
Normal file
7
compose.override.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
ports:
|
||||
- "5432"
|
||||
###< doctrine/doctrine-bundle ###
|
25
compose.yaml
Normal file
25
compose.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
image: postgres:${POSTGRES_VERSION:-16}-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-app}
|
||||
# You should definitely change the password in production
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-app}
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
volumes:
|
||||
- database_data:/var/lib/postgresql/data:rw
|
||||
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/db/data:/var/lib/postgresql/data:rw
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
volumes:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database_data:
|
||||
###< doctrine/doctrine-bundle ###
|
@ -7,6 +7,10 @@
|
||||
"php": ">=8.2",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"doctrine/dbal": "^3",
|
||||
"doctrine/doctrine-bundle": "^2.13",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.3",
|
||||
"doctrine/orm": "^3.3",
|
||||
"symfony/console": "7.1.*",
|
||||
"symfony/dotenv": "7.1.*",
|
||||
"symfony/flex": "^2",
|
||||
@ -14,8 +18,6 @@
|
||||
"symfony/runtime": "7.1.*",
|
||||
"symfony/yaml": "7.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"php-http/discovery": true,
|
||||
@ -64,5 +66,8 @@
|
||||
"allow-contrib": false,
|
||||
"require": "7.1.*"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/maker-bundle": "^1.61"
|
||||
}
|
||||
}
|
||||
|
1612
composer.lock
generated
1612
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -2,4 +2,7 @@
|
||||
|
||||
return [
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
];
|
||||
|
54
config/packages/doctrine.yaml
Normal file
54
config/packages/doctrine.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
|
||||
# IMPORTANT: You MUST configure your server version,
|
||||
# either here or in the DATABASE_URL env var (see .env file)
|
||||
#server_version: '16'
|
||||
|
||||
profiling_collect_backtrace: '%kernel.debug%'
|
||||
use_savepoints: true
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
||||
enable_lazy_ghost_objects: true
|
||||
report_fields_where_declared: true
|
||||
validate_xml_mapping: true
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
identity_generation_preferences:
|
||||
Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity
|
||||
auto_mapping: true
|
||||
mappings:
|
||||
App:
|
||||
type: attribute
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
controller_resolver:
|
||||
auto_mapping: false
|
||||
|
||||
when@test:
|
||||
doctrine:
|
||||
dbal:
|
||||
# "TEST_TOKEN" is typically set by ParaTest
|
||||
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
|
||||
|
||||
when@prod:
|
||||
doctrine:
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
|
||||
query_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.system_cache_pool
|
||||
result_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.result_cache_pool
|
||||
|
||||
framework:
|
||||
cache:
|
||||
pools:
|
||||
doctrine.result_cache_pool:
|
||||
adapter: cache.app
|
||||
doctrine.system_cache_pool:
|
||||
adapter: cache.system
|
6
config/packages/doctrine_migrations.yaml
Normal file
6
config/packages/doctrine_migrations.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
doctrine_migrations:
|
||||
migrations_paths:
|
||||
# namespace is arbitrary but should be different from App\Migrations
|
||||
# as migrations classes should NOT be autoloaded
|
||||
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
||||
enable_profiler: false
|
0
migrations/.gitignore
vendored
Normal file
0
migrations/.gitignore
vendored
Normal file
20
src/Controller/SiteController.php
Normal file
20
src/Controller/SiteController.php
Normal 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
0
src/Entity/.gitignore
vendored
Normal file
339
src/Entity/Site.php
Normal file
339
src/Entity/Site.php
Normal 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
0
src/Repository/.gitignore
vendored
Normal file
43
src/Repository/SiteRepository.php
Normal file
43
src/Repository/SiteRepository.php
Normal 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()
|
||||
// ;
|
||||
// }
|
||||
}
|
36
symfony.lock
36
symfony.lock
@ -1,4 +1,31 @@
|
||||
{
|
||||
"doctrine/doctrine-bundle": {
|
||||
"version": "2.13",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "2.13",
|
||||
"ref": "8d96c0b51591ffc26794d865ba3ee7d193438a83"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/doctrine.yaml",
|
||||
"src/Entity/.gitignore",
|
||||
"src/Repository/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/doctrine-migrations-bundle": {
|
||||
"version": "3.3",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.1",
|
||||
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/doctrine_migrations.yaml",
|
||||
"migrations/.gitignore"
|
||||
]
|
||||
},
|
||||
"symfony/console": {
|
||||
"version": "7.1",
|
||||
"recipe": {
|
||||
@ -42,6 +69,15 @@
|
||||
"src/Kernel.php"
|
||||
]
|
||||
},
|
||||
"symfony/maker-bundle": {
|
||||
"version": "1.61",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.0",
|
||||
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
|
||||
}
|
||||
},
|
||||
"symfony/routing": {
|
||||
"version": "7.1",
|
||||
"recipe": {
|
||||
|
Loading…
Reference in New Issue
Block a user