Compare commits
30 Commits
042b94f1af
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fc6977362 | |||
| 386653b6bf | |||
| f35be9c845 | |||
| f91d88e04c | |||
| eabb619d90 | |||
| 875ca03568 | |||
| 660d409093 | |||
| b446c66fd6 | |||
| 42e32952d6 | |||
| 72af052651 | |||
| e98cbc585b | |||
| 726772ed75 | |||
| c0d5b38a89 | |||
| 321a6a4bea | |||
| 7ab75a30fb | |||
| 660de08377 | |||
| e402dbe97f | |||
| e5810d94c6 | |||
| 696ef51508 | |||
| 2fa1d2d99e | |||
| b84d4589fe | |||
| 68854f875b | |||
| f573b4deca | |||
| 6dc99531c7 | |||
| 95d78be851 | |||
| 851808021a | |||
| dc06764e36 | |||
| faee735af8 | |||
| 691a78579e | |||
| b55f968201 |
90
composer.lock
generated
90
composer.lock
generated
@@ -347,16 +347,16 @@
|
||||
},
|
||||
{
|
||||
"name": "doctrine/doctrine-bundle",
|
||||
"version": "2.13.0",
|
||||
"version": "2.13.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/DoctrineBundle.git",
|
||||
"reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563"
|
||||
"reference": "2740ad8b8739b39ab37d409c972b092f632b025a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/ca59d84b8e63143ce1aed90cdb333ba329d71563",
|
||||
"reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563",
|
||||
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/2740ad8b8739b39ab37d409c972b092f632b025a",
|
||||
"reference": "2740ad8b8739b39ab37d409c972b092f632b025a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -370,7 +370,7 @@
|
||||
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/deprecation-contracts": "^2.1 || ^3",
|
||||
"symfony/doctrine-bridge": "^5.4.19 || ^6.0.7 || ^7.0",
|
||||
"symfony/doctrine-bridge": "^5.4.46 || ^6.4.3 || ^7.0.3",
|
||||
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/polyfill-php80": "^1.15",
|
||||
"symfony/service-contracts": "^1.1.1 || ^2.0 || ^3"
|
||||
@@ -447,7 +447,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/DoctrineBundle/issues",
|
||||
"source": "https://github.com/doctrine/DoctrineBundle/tree/2.13.0"
|
||||
"source": "https://github.com/doctrine/DoctrineBundle/tree/2.13.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -463,7 +463,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-01T09:46:40+00:00"
|
||||
"time": "2024-11-08T23:27:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/doctrine-migrations-bundle",
|
||||
@@ -1746,16 +1746,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v7.1.7",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a"
|
||||
"reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a",
|
||||
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5",
|
||||
"reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1819,7 +1819,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v7.1.7"
|
||||
"source": "https://github.com/symfony/console/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1835,20 +1835,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-05T15:34:55+00:00"
|
||||
"time": "2024-11-06T14:23:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dependency-injection.git",
|
||||
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd"
|
||||
"reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
|
||||
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e4d13f0f394f4d02a041ff76acd31c5a20a5f70b",
|
||||
"reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1899,7 +1899,7 @@
|
||||
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1915,7 +1915,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-10-25T15:11:02+00:00"
|
||||
"time": "2024-11-09T09:16:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
@@ -2745,16 +2745,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v7.1.7",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "5183b61657807099d98f3367bcccb850238b17a9"
|
||||
"reference": "f4419ec69ccfc3f725a4de7c20e4e57626d10112"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5183b61657807099d98f3367bcccb850238b17a9",
|
||||
"reference": "5183b61657807099d98f3367bcccb850238b17a9",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/f4419ec69ccfc3f725a4de7c20e4e57626d10112",
|
||||
"reference": "f4419ec69ccfc3f725a4de7c20e4e57626d10112",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2764,12 +2764,12 @@
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/dbal": "<3.6",
|
||||
"symfony/cache": "<6.4"
|
||||
"symfony/cache": "<6.4.12|>=7.0,<7.1.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^3.6|^4",
|
||||
"predis/predis": "^1.1|^2.0",
|
||||
"symfony/cache": "^6.4|^7.0",
|
||||
"symfony/cache": "^6.4.12|^7.1.5",
|
||||
"symfony/dependency-injection": "^6.4|^7.0",
|
||||
"symfony/expression-language": "^6.4|^7.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0",
|
||||
@@ -2802,7 +2802,7 @@
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.1.7"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2818,20 +2818,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-06T09:02:46+00:00"
|
||||
"time": "2024-11-09T09:16:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v7.1.7",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "7f137cda31fd41e422edcdc01915f2c095b84399"
|
||||
"reference": "33fef24e3dc79d6d30bf4936531f2f4bd2ca189e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/7f137cda31fd41e422edcdc01915f2c095b84399",
|
||||
"reference": "7f137cda31fd41e422edcdc01915f2c095b84399",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/33fef24e3dc79d6d30bf4936531f2f4bd2ca189e",
|
||||
"reference": "33fef24e3dc79d6d30bf4936531f2f4bd2ca189e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2916,7 +2916,7 @@
|
||||
"description": "Provides a structured process for converting a Request into a Response",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.1.7"
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2932,7 +2932,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-06T09:54:34+00:00"
|
||||
"time": "2024-11-13T14:25:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
@@ -3556,16 +3556,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626"
|
||||
"reference": "591ebd41565f356fcd8b090fe64dbb5878f50281"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/61b72d66bf96c360a727ae6232df5ac83c71f626",
|
||||
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281",
|
||||
"reference": "591ebd41565f356fcd8b090fe64dbb5878f50281",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3623,7 +3623,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/string/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3639,20 +3639,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-25T14:20:29+00:00"
|
||||
"time": "2024-11-13T13:31:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v7.1.7",
|
||||
"version": "v7.1.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1"
|
||||
"reference": "7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f6ea51f669760cacd7464bf7eaa0be87b8072db1",
|
||||
"reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8",
|
||||
"reference": "7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3706,7 +3706,7 @@
|
||||
"dump"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v7.1.7"
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v7.1.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3722,7 +3722,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-05T15:34:55+00:00"
|
||||
"time": "2024-11-08T15:46:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-exporter",
|
||||
|
||||
@@ -16,13 +16,20 @@ class FindingController extends AbstractController
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Finding::class);
|
||||
$imgRepo = $em->getRepository(Image::class);
|
||||
|
||||
$findings = $repo->findAll();
|
||||
$findings = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
foreach($findings as $key => $finding) {
|
||||
$coords = $repo->coordinates($finding->getId());
|
||||
$finding->setLat($coords['lat']);
|
||||
$finding->setLng($coords['lng']);
|
||||
// TODO N + 1!!
|
||||
$images = $imgRepo->findBy(
|
||||
['finding' => $finding->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
$finding->setImages($images);
|
||||
$findings[$key] = $finding;
|
||||
}
|
||||
|
||||
|
||||
36
src/Controller/GeoImageController.php
Normal file
36
src/Controller/GeoImageController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use App\Entity\GeoImage;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class GeoImageController extends AbstractController
|
||||
{
|
||||
#[Route('/geoimages', name: 'app_geo_images')]
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(GeoImage::class);
|
||||
$geoImages = $repo->findAllWithGeometry();
|
||||
|
||||
return $this->json($geoImages);
|
||||
}
|
||||
|
||||
#[Route('/geoimages/menu', name: 'app_geo_image_menu')]
|
||||
public function menu(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(GeoImage::class);
|
||||
$geoImages = $repo->findLabelsAndIds();
|
||||
|
||||
return $this->json($geoImages);
|
||||
}
|
||||
|
||||
#[Route('/geoimages/{id}', name: 'app_geo_image_record')]
|
||||
public function record(GeoImage $geoImage): JsonResponse
|
||||
{
|
||||
return $this->json($geoImage);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\NotConserved;
|
||||
use App\Entity\Bibliography;
|
||||
use App\Entity\Document;
|
||||
use App\Entity\Image;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@@ -16,8 +18,9 @@ class NotConservedController extends AbstractController
|
||||
{
|
||||
$repo = $em->getRepository(NotConserved::class);
|
||||
//$repoBib = $em->getRepository(Bibliography::class);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
|
||||
$records = $repo->findBy([], ['id' => 'ASC']);
|
||||
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
// Terrible? N+1..
|
||||
foreach ($records as $key => $record) {
|
||||
@@ -26,6 +29,12 @@ class NotConservedController extends AbstractController
|
||||
$record->setLng($repo->coordinates($id)['lng']);
|
||||
//$biblio = $repoBib->findAllByNotConserved($id);
|
||||
//$record->setBibliographies($biblio);
|
||||
$images = $repoImg->findBy(
|
||||
['notConserved' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$record->setImages($images);
|
||||
$records[$key] = $record;
|
||||
}
|
||||
|
||||
@@ -44,14 +53,21 @@ class NotConservedController extends AbstractController
|
||||
$repo = $em->getRepository(Bibliography::class);
|
||||
|
||||
$biblio = $repo->findAllByNotConserved($notConserved->getId());
|
||||
|
||||
$repo = $em->getRepository(Document::class);
|
||||
$documents = $repo->findByNotConserved($notConserved->getId());
|
||||
$notConserved->setBibliographies($biblio);
|
||||
$notConserved->setDocuments($documents);
|
||||
|
||||
$notConserved->setLat($coordinates['lat']);
|
||||
$notConserved->setLng($coordinates['lng']);
|
||||
|
||||
return $this->json(
|
||||
$notConserved,
|
||||
$repo = $em->getRepository(Image::class);
|
||||
$images = $repo->findBy(
|
||||
['notConserved' => $notConserved->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$notConserved->setImages($images);
|
||||
|
||||
return $this->json($notConserved);
|
||||
}
|
||||
}
|
||||
|
||||
70
src/Controller/PrehistoricController.php
Normal file
70
src/Controller/PrehistoricController.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Prehistoric;
|
||||
//use App\Entity\Bibliography;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class PrehistoricController extends AbstractController
|
||||
{
|
||||
#[Route('/prehistoric', name: 'app_prehistoric')]
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Prehistoric::class);
|
||||
//$repoBib = $em->getRepository(Bibliography::class);
|
||||
|
||||
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
// Terrible? N+1..
|
||||
foreach ($records as $key => $record) {
|
||||
$id = $record->getId();
|
||||
$record->setLat($repo->coordinates($id)['lat']);
|
||||
$record->setLng($repo->coordinates($id)['lng']);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
|
||||
$images = $repoImg->findBy(
|
||||
['prehistoric' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$record->setImages($images);
|
||||
$records[$key] = $record;
|
||||
}
|
||||
|
||||
return $this->json([
|
||||
'message' => 'All records for prehistoric assets',
|
||||
'records' => $records
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/prehistoric/{id<\d+>}', name: 'app_prehistoric_record')]
|
||||
public function record(Prehistoric $prehistoric, EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Prehistoric::class);
|
||||
$coordinates = $repo->coordinates($prehistoric->getId());
|
||||
//$repo = $em->getRepository(Bibliography::class);
|
||||
|
||||
//$biblio = $repo->findAllByNotConserved($prehistoric->getId());
|
||||
//$notConserved->setBibliographies($biblio);
|
||||
|
||||
$prehistoric->setLat($coordinates['lat']);
|
||||
$prehistoric->setLng($coordinates['lng']);
|
||||
$repo = $em->getRepository(Image::class);
|
||||
|
||||
$images = $repo->findBy(
|
||||
['prehistoric' => $prehistoric->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$prehistoric->setImages($images);
|
||||
|
||||
return $this->json($prehistoric);
|
||||
}
|
||||
}
|
||||
|
||||
66
src/Controller/ReuseController.php
Normal file
66
src/Controller/ReuseController.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Reuse;
|
||||
use App\Entity\Bibliography;
|
||||
use App\Entity\Image;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class ReuseController extends AbstractController
|
||||
{
|
||||
#[Route('/reuse', name: 'app_reuse')]
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Reuse::class);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
|
||||
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
// Terrible? N+1..
|
||||
foreach ($records as $key => $record) {
|
||||
$id = $record->getId();
|
||||
$record->setLat($repo->coordinates($id)['lat']);
|
||||
$record->setLng($repo->coordinates($id)['lng']);
|
||||
$images = $repoImg->findBy(
|
||||
['reuse' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$record->setImages($images);
|
||||
$records[$key] = $record;
|
||||
}
|
||||
|
||||
return $this->json([
|
||||
'message' => 'All records for reused assets',
|
||||
'records' => $records
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/reuse/{id<\d+>}', name: 'app_reuse_record')]
|
||||
public function record(Reuse $reuse, EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Reuse::class);
|
||||
$coordinates = $repo->coordinates($reuse->getId());
|
||||
$repo = $em->getRepository(Bibliography::class);
|
||||
|
||||
$biblio = $repo->findAllByReuse($reuse->getId());
|
||||
$reuse->setBibliography($biblio);
|
||||
|
||||
$reuse->setLat($coordinates['lat']);
|
||||
$reuse->setLng($coordinates['lng']);
|
||||
$repo = $em->getRepository(Image::class);
|
||||
$images = $repo->findBy(
|
||||
['reuse' => $reuse->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$reuse->setImages($images);
|
||||
|
||||
return $this->json($reuse);
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,43 @@ use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
|
||||
class SiteController extends AbstractController
|
||||
{
|
||||
#[Route('/site/{gisId<\w+>}', name: 'app_site')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['gisId' => 'gisId'])]
|
||||
Site $site,
|
||||
EntityManagerInterface $em
|
||||
): JsonResponse
|
||||
#[Route('/sites', name: 'app_site')]
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Site::class);
|
||||
|
||||
$sites = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
// TODO N+1...
|
||||
foreach($sites as $key => $site) {
|
||||
$coords = $repo->coordinates($site->getId());
|
||||
$site->setLat($coords['lat']);
|
||||
$site->setLng($coords['lng']);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
$images = new ArrayCollection(
|
||||
$repoImg->findBy(
|
||||
['site' => $site->getId()],
|
||||
['sequence' => 'ASC']
|
||||
)
|
||||
);
|
||||
$repoDocs = $em->getRepository(Document::class);
|
||||
$documents = $repoDocs->findBySite($site->getId());
|
||||
$repoBib = $em->getRepository(Bibliography::class);
|
||||
$bibliography = $repoBib->findAllBySite($site->getId());
|
||||
|
||||
$site->setImages($images);
|
||||
$site->setDocuments($documents);
|
||||
$site->setBibliography($bibliography);
|
||||
|
||||
$sites[$key] = $site;
|
||||
}
|
||||
|
||||
return $this->json($sites);
|
||||
}
|
||||
|
||||
#[Route('/sites/{id<\w+>}', name: 'app_site_record')]
|
||||
//#[MapEntity(mapping: ['gisId' => 'gisId'])]
|
||||
public function record(Site $site, EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Site::class);
|
||||
$coords = $repo->coordinates($site->getId());
|
||||
|
||||
63
src/Controller/UnderwaterController.php
Normal file
63
src/Controller/UnderwaterController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Document;
|
||||
use App\Entity\Image;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use App\Entity\Underwater;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class UnderwaterController extends AbstractController
|
||||
{
|
||||
#[Route('/underwater', name: 'app_underwater')]
|
||||
public function index(EntityManagerInterface $em): JsonResponse
|
||||
{
|
||||
$repo = $em->getRepository(Underwater::class);
|
||||
$imgRepo = $em->getRepository(Image::class);
|
||||
|
||||
$underwater = $repo->findAll();
|
||||
|
||||
/**
|
||||
* @var Underwater $record
|
||||
*/
|
||||
foreach ($underwater as $key => $record) {
|
||||
$coords = $repo->coordinates($record->getId());
|
||||
$record->setLat($coords['lat']);
|
||||
$record->setLng($coords['lng']);
|
||||
// TODO N + 1!!
|
||||
$images = $imgRepo->findBy(
|
||||
['underwater' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
$record->setImages($images);
|
||||
$underwater[$key] = $record;
|
||||
}
|
||||
|
||||
return $this->json(['records' => $underwater]);
|
||||
}
|
||||
|
||||
#[Route('/underwater/{id<\d+>}', name: 'app_underwater_record')]
|
||||
public function record(Underwater $record, EntityManagerInterface $em)
|
||||
{
|
||||
$repo = $em->getRepository(Underwater::class);
|
||||
$docRepo = $em->getRepository(Document::class);
|
||||
$documents = $docRepo->findByUnderwater($record->getId());
|
||||
$imgRepo = $em->getRepository(Image::class);
|
||||
$images = $imgRepo->findBy(
|
||||
['underwater' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$coords = $repo->coordinates($record->getId());
|
||||
$record->setLat($coords['lat']);
|
||||
$record->setLng($coords['lng']);
|
||||
$record->setImages($images);
|
||||
$record->setDocuments($documents);
|
||||
|
||||
return $this->json($record);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,12 @@ class Finding implements \JsonSerializable
|
||||
#[ORM\Column(length: 40, nullable: true, name: 'misure')]
|
||||
private ?string $measurements = null;
|
||||
|
||||
#[ORM\Column(name: 'comune', length: 10, nullable: false)]
|
||||
private ?string $municipality = null;
|
||||
|
||||
#[ORM\Column(name: 'etichetta', length: 150, nullable: false)]
|
||||
private ?string $label = null;
|
||||
|
||||
private ?float $lat = null;
|
||||
|
||||
private ?float $lng = null;
|
||||
@@ -59,7 +65,7 @@ class Finding implements \JsonSerializable
|
||||
private ?array $bibliography = null;
|
||||
|
||||
/**
|
||||
* @var Bibliography[] $images
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
@@ -207,6 +213,30 @@ class Finding implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(?string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMunicipality(): ?string
|
||||
{
|
||||
return $this->municipality;
|
||||
}
|
||||
|
||||
public function setMunicipality(?string $municipality): static
|
||||
{
|
||||
$this->municipality = $municipality;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLat(): ?float
|
||||
{
|
||||
return $this->lat;
|
||||
@@ -269,6 +299,8 @@ class Finding implements \JsonSerializable
|
||||
'conservationPlace' => $this->conservationPlace,
|
||||
'description' => $this->description,
|
||||
'author' => $this->author,
|
||||
'label' => $this->label,
|
||||
'municipality' => $this->municipality,
|
||||
'coordinates' => [$this->lat, $this->lng],
|
||||
'bibliography' => $this->bibliography,
|
||||
'images' => $this->images,
|
||||
|
||||
85
src/Entity/GeoImage.php
Normal file
85
src/Entity/GeoImage.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\GeoImageRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JsonSerializable;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GeoImageRepository::class)]
|
||||
#[ORM\Table(name: 'geo_immagine_catasto')]
|
||||
class GeoImage implements JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $filename = null;
|
||||
|
||||
#[ORM\Column(type: Types::JSON, name: 'poligono')]
|
||||
private ?string $polygon = null;
|
||||
|
||||
#[ORM\Column(length: 60, name: 'etichetta')]
|
||||
private ?string $label = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFilename(): ?string
|
||||
{
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
public function setFilename(string $filename): static
|
||||
{
|
||||
$this->filename = $filename;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPolygon(): ?string
|
||||
{
|
||||
return $this->polygon;
|
||||
}
|
||||
|
||||
public function setPolygon(string $polygon): static
|
||||
{
|
||||
$this->polygon = $polygon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->polygon;
|
||||
}
|
||||
|
||||
public function setLabel(string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'filename' => $this->filename,
|
||||
'polygon' => $this->polygon,
|
||||
'label' => $this->label,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,18 @@ class Image implements \JsonSerializable
|
||||
#[ORM\Column(name: 'rinvenimento', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $finding = null;
|
||||
|
||||
#[ORM\Column(name: 'non_conserv', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $notConserved = null;
|
||||
|
||||
#[ORM\Column(name: 'affioramento', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $prehistoric = null;
|
||||
|
||||
#[ORM\Column(name: 'reimpiego', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $reuse = null;
|
||||
|
||||
#[ORM\Column(name: 'giacimento', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $underwater = null;
|
||||
|
||||
#[ORM\Column(name: 'ordine', type: Types::SMALLINT)]
|
||||
private ?int $sequence = null;
|
||||
|
||||
@@ -109,6 +121,54 @@ class Image implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNotConserved(): ?string
|
||||
{
|
||||
return $this->notConserved;
|
||||
}
|
||||
|
||||
public function setNotConserved(?string $notConserved): static
|
||||
{
|
||||
$this->notConserved = $notConserved;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrehistoric(): ?string
|
||||
{
|
||||
return $this->prehistoric;
|
||||
}
|
||||
|
||||
public function setPrehistoric(?string $prehistoric): static
|
||||
{
|
||||
$this->prehistoric = $prehistoric;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReuse(): ?string
|
||||
{
|
||||
return $this->reuse;
|
||||
}
|
||||
|
||||
public function setReuse(?string $reuse): static
|
||||
{
|
||||
$this->reuse = $reuse;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUnderwater(): ?string
|
||||
{
|
||||
return $this->underwater;
|
||||
}
|
||||
|
||||
public function setUnderwater(?string $underwater): static
|
||||
{
|
||||
$this->underwater = $underwater;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSequence(): ?int
|
||||
{
|
||||
return $this->sequence;
|
||||
|
||||
@@ -28,6 +28,11 @@ class NotConserved implements \JsonSerializable
|
||||
*/
|
||||
private ?array $bibliographies = null;
|
||||
|
||||
/**
|
||||
* @var Document[] $documents
|
||||
*/
|
||||
private ?array $documents = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'periodo')]
|
||||
private ?string $period = null;
|
||||
|
||||
@@ -40,6 +45,17 @@ class NotConserved implements \JsonSerializable
|
||||
#[ORM\Column(name: 'autore_scheda', length: 100, nullable: true)]
|
||||
private ?string $author = null;
|
||||
|
||||
#[ORM\Column(name: 'comune', length: 10, nullable: false)]
|
||||
private ?string $municipality = null;
|
||||
|
||||
#[ORM\Column(name: 'etichetta', length: 100, nullable: false)]
|
||||
private ?string $label = null;
|
||||
|
||||
/**
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -100,6 +116,18 @@ class NotConserved implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDocuments(): ?array
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
public function setDocuments(array $documents): static
|
||||
{
|
||||
$this->documents = $documents;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPeriod(): ?string
|
||||
{
|
||||
return $this->period;
|
||||
@@ -148,6 +176,48 @@ class NotConserved implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(?string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMunicipality(): ?string
|
||||
{
|
||||
return $this->municipality;
|
||||
}
|
||||
|
||||
public function setMunicipality(?string $municipality): static
|
||||
{
|
||||
$this->municipality = $municipality;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Image[]
|
||||
*/
|
||||
public function getImages(): array
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Image[] $images
|
||||
*/
|
||||
public function setImages(array $images): static
|
||||
{
|
||||
$this->images = $images;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
@@ -158,7 +228,11 @@ class NotConserved implements \JsonSerializable
|
||||
'period' => $this->period,
|
||||
'shortDescription' => $this->shortDescription,
|
||||
'author' => $this->author,
|
||||
'municipality' => $this->municipality,
|
||||
'label' => $this->label,
|
||||
'bibliography' => $this->bibliographies,
|
||||
'documents' => $this->documents,
|
||||
'images' => $this->images,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
217
src/Entity/Prehistoric.php
Normal file
217
src/Entity/Prehistoric.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PrehistoricRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PrehistoricRepository::class)]
|
||||
#[ORM\Table(name: 'preistoria')]
|
||||
class Prehistoric implements \JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255, name: 'denominazione')]
|
||||
private ?string $denomination = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'loc_generica')]
|
||||
private ?string $genericPlace = null;
|
||||
|
||||
#[ORM\Column(length: 120, nullable: true, name: 'periodo')]
|
||||
private ?string $period = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true, name: 'descrizione')]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'conservazione')]
|
||||
private ?string $conservation = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'autore_scheda')]
|
||||
private ?string $author = null;
|
||||
|
||||
#[ORM\Column(name: 'comune', length: 10, nullable: false)]
|
||||
private ?string $municipality = null;
|
||||
|
||||
#[ORM\Column(name: 'etichetta', length: 150, nullable: false)]
|
||||
private ?string $label = null;
|
||||
|
||||
private ?float $lat;
|
||||
|
||||
private ?float $lng;
|
||||
|
||||
/**
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDenomination(): ?string
|
||||
{
|
||||
return $this->denomination;
|
||||
}
|
||||
|
||||
public function setDenomination(string $denomination): static
|
||||
{
|
||||
$this->denomination = $denomination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGenericPlace(): ?string
|
||||
{
|
||||
return $this->genericPlace;
|
||||
}
|
||||
|
||||
public function setGenericPlace(?string $genericPlace): static
|
||||
{
|
||||
$this->genericPlace = $genericPlace;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPeriod(): ?string
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
|
||||
public function setPeriod(?string $period): static
|
||||
{
|
||||
$this->period = $period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConservation(): ?string
|
||||
{
|
||||
return $this->conservation;
|
||||
}
|
||||
|
||||
public function setConservation(?string $conservation): static
|
||||
{
|
||||
$this->conservation = $conservation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAuthor(): ?string
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
public function setAuthor(?string $author): static
|
||||
{
|
||||
$this->author = $author;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Image[]
|
||||
*/
|
||||
public function getImages(): array
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Image[] $images
|
||||
*/
|
||||
public function setImages(array $images): static
|
||||
{
|
||||
$this->images = $images;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(?string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMunicipality(): ?string
|
||||
{
|
||||
return $this->municipality;
|
||||
}
|
||||
|
||||
public function setMunicipality(?string $municipality): static
|
||||
{
|
||||
$this->municipality = $municipality;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'denomination' => $this->denomination,
|
||||
'genericPlace' => $this->genericPlace,
|
||||
'period' => $this->period,
|
||||
'conservation' => $this->conservation,
|
||||
'author' => $this->author,
|
||||
'description' => $this->description,
|
||||
'label' => $this->label,
|
||||
'municipality' => $this->municipality,
|
||||
'coordinates' => [$this->lat, $this->lng],
|
||||
'images' => $this->images,
|
||||
];
|
||||
}
|
||||
}
|
||||
277
src/Entity/Reuse.php
Normal file
277
src/Entity/Reuse.php
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ReuseRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReuseRepository::class)]
|
||||
#[ORM\Table(name: 'reimpiego')]
|
||||
class Reuse implements \JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 200, name: 'denominazione')]
|
||||
private ?string $denomination = null;
|
||||
|
||||
#[ORM\Column(length: 200, nullable: true, name: 'materia')]
|
||||
private ?string $material = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true, name: 'rinvenimento')]
|
||||
private ?string $finding = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true, name: 'misure')]
|
||||
private ?string $measurements = null;
|
||||
|
||||
#[ORM\Column(length: 200, nullable: true, name: 'datazione')]
|
||||
private ?string $dating = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'stato_conservazione')]
|
||||
private ?string $conservationState = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'luogo_conservazione')]
|
||||
private ?string $conservationPlace = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true, name: 'descrizione')]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'autore_scheda')]
|
||||
private ?string $author = null;
|
||||
|
||||
#[ORM\Column(name: 'comune', length: 10, nullable: false)]
|
||||
private ?string $municipality = null;
|
||||
|
||||
#[ORM\Column(name: 'etichetta', length: 150, nullable: false)]
|
||||
private ?string $label = null;
|
||||
|
||||
private ?float $lat = null;
|
||||
|
||||
private ?float $lng = null;
|
||||
|
||||
/**
|
||||
* @var Bibliography[] $bibliography
|
||||
*/
|
||||
private ?array $bibliography = null;
|
||||
|
||||
/**
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDenomination(): ?string
|
||||
{
|
||||
return $this->denomination;
|
||||
}
|
||||
|
||||
public function setDenomination(string $denomination): static
|
||||
{
|
||||
$this->denomination = $denomination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMaterial(): ?string
|
||||
{
|
||||
return $this->material;
|
||||
}
|
||||
|
||||
public function setMaterial(?string $material): static
|
||||
{
|
||||
$this->material = $material;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFinding(): ?string
|
||||
{
|
||||
return $this->finding;
|
||||
}
|
||||
|
||||
public function setFinding(?string $finding): static
|
||||
{
|
||||
$this->finding = $finding;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDating(): ?string
|
||||
{
|
||||
return $this->dating;
|
||||
}
|
||||
|
||||
public function setDating(?string $dating): static
|
||||
{
|
||||
$this->dating = $dating;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConservationState(): ?string
|
||||
{
|
||||
return $this->conservationState;
|
||||
}
|
||||
|
||||
public function setConservationState(?string $conservationState): static
|
||||
{
|
||||
$this->conservationState = $conservationState;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConservationPlace(): ?string
|
||||
{
|
||||
return $this->conservationPlace;
|
||||
}
|
||||
|
||||
public function setConservationPlace(?string $conservationPlace): static
|
||||
{
|
||||
$this->conservationPlace = $conservationPlace;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAuthor(): ?string
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
public function setAuthor(string $author): static
|
||||
{
|
||||
$this->author = $author;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMeasurements(): ?string
|
||||
{
|
||||
return $this->measurements;
|
||||
}
|
||||
|
||||
public function setMeasurements(?string $measurements): static
|
||||
{
|
||||
$this->measurements = $measurements;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(?string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMunicipality(): ?string
|
||||
{
|
||||
return $this->municipality;
|
||||
}
|
||||
|
||||
public function setMunicipality(?string $municipality): static
|
||||
{
|
||||
$this->municipality = $municipality;
|
||||
|
||||
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 getBibliography(): ?array
|
||||
{
|
||||
return $this->bibliography;
|
||||
}
|
||||
|
||||
public function setBibliography(array $bibliography): static
|
||||
{
|
||||
$this->bibliography = $bibliography;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImages(): ?array
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
public function setImages(array $images): static
|
||||
{
|
||||
$this->images = $images;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'denomination' => $this->denomination,
|
||||
'material' => $this->material,
|
||||
'measurements' => $this->measurements,
|
||||
'finding' => $this->finding,
|
||||
'dating' => $this->dating,
|
||||
'conservationState' => $this->conservationState,
|
||||
'conservationPlace' => $this->conservationPlace,
|
||||
'description' => $this->description,
|
||||
'author' => $this->author,
|
||||
'label' => $this->label,
|
||||
'municipality' => $this->municipality,
|
||||
'coordinates' => [$this->lat, $this->lng],
|
||||
'bibliography' => $this->bibliography,
|
||||
'images' => $this->images,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -59,8 +59,14 @@ class Site implements JsonSerializable
|
||||
#[ORM\Column(name: 'luogo_custodia_mat', type: Types::TEXT, nullable: true)]
|
||||
private ?string $conservationPlace = null;
|
||||
|
||||
#[ORM\Column(name: 'documenti', type: Types::TEXT, nullable: true)]
|
||||
private ?string $documentation = null;
|
||||
|
||||
#[ORM\Column(name: 'rilievi', length: 255, nullable: true)]
|
||||
private ?string $surveys = null;
|
||||
|
||||
#[ORM\Column(name: 'proprietà', length: 255, nullable: true)]
|
||||
private ?string $ownedBy = null;
|
||||
private ?string $ownership = null;
|
||||
|
||||
#[ORM\Column(name: 'gis_id', length: 20)]
|
||||
private ?string $gisId = null;
|
||||
@@ -80,6 +86,15 @@ class Site implements JsonSerializable
|
||||
#[ORM\Column(name: 'autore_scheda', nullable: true)]
|
||||
private ?string $author = null;
|
||||
|
||||
#[ORM\Column(name: 'geojson', nullable: false, type: Types::BOOLEAN)]
|
||||
private ?bool $geojson = null;
|
||||
|
||||
#[ORM\Column(name: 'area', nullable: false, type: Types::BOOLEAN)]
|
||||
private ?bool $area = null;
|
||||
|
||||
#[ORM\Column(name: 'etichetta', nullable: false, length: 100)]
|
||||
private ?string $label = null;
|
||||
|
||||
private ?float $lat;
|
||||
|
||||
private ?float $lng;
|
||||
@@ -276,14 +291,26 @@ class Site implements JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwnedBy(): ?string
|
||||
public function getSurveys(): ?string
|
||||
{
|
||||
return $this->ownedBy;
|
||||
return $this->surveys;
|
||||
}
|
||||
|
||||
public function setOwnedBy(?string $ownedBy): static
|
||||
public function setSurveys(?string $surveys): static
|
||||
{
|
||||
$this->ownedBy = $ownedBy;
|
||||
$this->surveys = $surveys;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwnership(): ?string
|
||||
{
|
||||
return $this->ownership;
|
||||
}
|
||||
|
||||
public function setOwnership(?string $ownership): static
|
||||
{
|
||||
$this->ownership = $ownership;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -336,6 +363,18 @@ class Site implements JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDocumentation(): ?string
|
||||
{
|
||||
return $this->documentation;
|
||||
}
|
||||
|
||||
public function setDocumentation(string $documentation): static
|
||||
{
|
||||
$this->documentation = $documentation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTechniques(): ?string
|
||||
{
|
||||
return $this->techniques;
|
||||
@@ -436,17 +475,22 @@ class Site implements JsonSerializable
|
||||
'chronology' => $this->chronology,
|
||||
'motivation' => $this->chronologyMotivation,
|
||||
'finding' => $this->finding,
|
||||
'surveys' => $this->surveys,
|
||||
'materials' => $this->materials,
|
||||
'conservationState' => $this->conservationState,
|
||||
'conservationPlace' => $this->conservationPlace,
|
||||
'documentation' => $this->documentation,
|
||||
'description' => $this->description,
|
||||
'shortDescription' => $this->shortDescription,
|
||||
'ownedBy' => $this->ownedBy,
|
||||
'ownership' => $this->ownership,
|
||||
'images' => $this->images->toArray(),
|
||||
'documents' => $this->documents,
|
||||
'bibliography' => $this->bibliography,
|
||||
'techniques' => $this->techniques,
|
||||
'author' => $this->author,
|
||||
'geojson' => $this->geojson,
|
||||
'area' => $this->area,
|
||||
'label' => $this->label,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
214
src/Entity/Underwater.php
Normal file
214
src/Entity/Underwater.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UnderwaterRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JsonSerializable;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UnderwaterRepository::class)]
|
||||
#[ORM\Table(name: 'giacimento')]
|
||||
class Underwater implements JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255, name: 'denominazione')]
|
||||
private ?string $denomination = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true, name: 'loc_generica')]
|
||||
private ?string $genericPlace = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true, name: 'periodo')]
|
||||
private ?string $period = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true, name: 'descrizione_breve')]
|
||||
private ?string $shortDescription = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true, name: 'conservazione')]
|
||||
private ?string $conservationState = null;
|
||||
|
||||
#[ORM\Column(length: 80, nullable: true, name: 'autore_scheda')]
|
||||
private ?string $author = null;
|
||||
|
||||
#[ORM\Column(length: 80, nullable: false, name: 'etichetta')]
|
||||
private ?string $label = null;
|
||||
|
||||
private ?float $lat = null;
|
||||
|
||||
private ?float $lng = null;
|
||||
|
||||
/**
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
/**
|
||||
* @var Document[] $documents
|
||||
*/
|
||||
private ?array $documents = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDenomination(): ?string
|
||||
{
|
||||
return $this->denomination;
|
||||
}
|
||||
|
||||
public function setDenomination(string $denomination): static
|
||||
{
|
||||
$this->denomination = $denomination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGenericPlace(): ?string
|
||||
{
|
||||
return $this->genericPlace;
|
||||
}
|
||||
|
||||
public function setGenericPlace(?string $genericPlace): static
|
||||
{
|
||||
$this->genericPlace = $genericPlace;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPeriod(): ?string
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
|
||||
public function setPeriod(?string $period): static
|
||||
{
|
||||
$this->period = $period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShortDescription(): ?string
|
||||
{
|
||||
return $this->shortDescription;
|
||||
}
|
||||
|
||||
public function setShortDescription(?string $shortDescription): static
|
||||
{
|
||||
$this->shortDescription = $shortDescription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConservationState(): ?string
|
||||
{
|
||||
return $this->conservationState;
|
||||
}
|
||||
|
||||
public function setConservationState(?string $conservationState): static
|
||||
{
|
||||
$this->conservationState = $conservationState;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAuthor(): ?string
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
public function setAuthor(?string $author): static
|
||||
{
|
||||
$this->author = $author;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(?string $label): static
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLat(): ?float
|
||||
{
|
||||
return $this->lat;
|
||||
}
|
||||
|
||||
public function setLat(?float $latitude): static
|
||||
{
|
||||
$this->lat = $latitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLng(): ?float
|
||||
{
|
||||
return $this->lng;
|
||||
}
|
||||
|
||||
public function setLng(?float $longitude): static
|
||||
{
|
||||
$this->lng = $longitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImages(): ?array
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
public function setImages(?array $images): static
|
||||
{
|
||||
$this->images = $images;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDocuments(): ?array
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
public function setDocuments(?array $documents): static
|
||||
{
|
||||
$this->documents = $documents;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'genericPlace' => $this->genericPlace,
|
||||
'coordinates' => [$this->lat, $this->lng],
|
||||
'denomination' => $this->denomination,
|
||||
'period' => $this->period,
|
||||
'conservationState' => $this->conservationState,
|
||||
'shortDescription' => $this->shortDescription,
|
||||
'author' => $this->author,
|
||||
'label' => $this->label,
|
||||
'images' => $this->images,
|
||||
'documents' => $this->documents,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,5 @@ enum ImageType: string
|
||||
case Photo = 'foto';
|
||||
case Survey = 'rilievo';
|
||||
case Video = 'video';
|
||||
case Reconstruction = '3d';
|
||||
}
|
||||
@@ -22,74 +22,139 @@ class BibliographyRepository extends ServiceEntityRepository
|
||||
*/
|
||||
public function findAllBySite(int $siteId): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
'SELECT
|
||||
id,
|
||||
citazione,
|
||||
riferimento,
|
||||
pagine
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
b.id,
|
||||
b.citazione,
|
||||
b.riferimento,
|
||||
bs.pagine
|
||||
FROM bibliografia b
|
||||
JOIN bibliografia_sito
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_sito = :id
|
||||
ORDER BY ordine ASC',
|
||||
$rsm
|
||||
);
|
||||
INNER JOIN bibliografia_sito bs ON bs.id_bibliografia = b.id
|
||||
WHERE bs.id_sito = :siteId
|
||||
ORDER BY bs.ordine ASC
|
||||
';
|
||||
|
||||
$query->setParameter('id', $siteId);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['siteId' => $siteId])->fetchAllAssociative();
|
||||
|
||||
return $query->getResult();
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$biblio = new Bibliography();
|
||||
$biblio->setId($row['id']);
|
||||
$biblio->setCitation($row['citazione']);
|
||||
$biblio->setReference($row['riferimento']);
|
||||
$biblio->setPages($row['pagine']);
|
||||
$entities[] = $biblio;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
public function findAllByNotConserved(int $notConserId): array
|
||||
public function findAllByNotConserved(int $notConservedId): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
'SELECT
|
||||
id,
|
||||
citazione,
|
||||
riferimento,
|
||||
pagine
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
b.id,
|
||||
b.citazione,
|
||||
b.riferimento,
|
||||
bs.pagine
|
||||
FROM bibliografia b
|
||||
JOIN bibliografia_non_conser
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_non_conser = :id
|
||||
ORDER BY ordine ASC',
|
||||
$rsm
|
||||
);
|
||||
INNER JOIN bibliografia_non_conser bs ON bs.id_bibliografia = b.id
|
||||
WHERE bs.id_non_conser = :notConservedId
|
||||
ORDER BY bs.ordine ASC
|
||||
';
|
||||
|
||||
$query->setParameter('id', $notConserId);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['notConservedId' => $notConservedId])->fetchAllAssociative();
|
||||
|
||||
return $query->getResult();
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$biblio = new Bibliography();
|
||||
$biblio->setId($row['id']);
|
||||
$biblio->setCitation($row['citazione']);
|
||||
$biblio->setReference($row['riferimento']);
|
||||
$biblio->setPages($row['pagine']);
|
||||
$entities[] = $biblio;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
public function findAllByFinding(int $findingId): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
'SELECT
|
||||
id,
|
||||
citazione,
|
||||
riferimento,
|
||||
pagine
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
b.id,
|
||||
b.citazione,
|
||||
b.riferimento,
|
||||
bs.pagine
|
||||
FROM bibliografia b
|
||||
JOIN bibliografia_rinvenim
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_rinvenimento = :id
|
||||
ORDER BY ordine ASC',
|
||||
$rsm
|
||||
);
|
||||
INNER JOIN bibliografia_rinvenim bs ON bs.id_bibliografia = b.id
|
||||
WHERE bs.id_rinvenimento = :findingId
|
||||
ORDER BY bs.ordine ASC
|
||||
';
|
||||
|
||||
$query->setParameter('id', $findingId);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['findingId' => $findingId])->fetchAllAssociative();
|
||||
|
||||
return $query->getResult();
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$biblio = new Bibliography();
|
||||
$biblio->setId($row['id']);
|
||||
$biblio->setCitation($row['citazione']);
|
||||
$biblio->setReference($row['riferimento']);
|
||||
$biblio->setPages($row['pagine']);
|
||||
$entities[] = $biblio;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
public function findAllByReuse(int $reuseId): array
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
b.id,
|
||||
b.citazione,
|
||||
b.riferimento,
|
||||
br.pagine
|
||||
FROM bibliografia b
|
||||
INNER JOIN bibliografia_reimpiego br ON br.id_bibliografia = b.id
|
||||
WHERE br.id_reimpiego = :reuseId
|
||||
ORDER BY br.ordine ASC
|
||||
';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['reuseId' => $reuseId])->fetchAllAssociative();
|
||||
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$biblio = new Bibliography();
|
||||
$biblio->setId($row['id']);
|
||||
$biblio->setCitation($row['citazione']);
|
||||
$biblio->setReference($row['riferimento']);
|
||||
$biblio->setPages($row['pagine']);
|
||||
$entities[] = $biblio;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,30 +22,126 @@ class DocumentRepository extends ServiceEntityRepository
|
||||
*/
|
||||
public function findBySite(int $siteId): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Document', 'd');
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
'SELECT
|
||||
id,
|
||||
titolo,
|
||||
filename,
|
||||
descrizione,
|
||||
autori,
|
||||
luogo,
|
||||
tipo
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
d.id,
|
||||
d.titolo,
|
||||
d.filename,
|
||||
d.descrizione,
|
||||
d.autori,
|
||||
d.tipo,
|
||||
d.luogo
|
||||
FROM documento d
|
||||
JOIN sito_documento
|
||||
ON id_documento = d.id
|
||||
WHERE id_sito = :id
|
||||
',
|
||||
$rsm
|
||||
);
|
||||
INNER JOIN sito_documento sd ON sd.id_documento = d.id
|
||||
WHERE sd.id_sito = :siteId
|
||||
ORDER BY d.titolo ASC
|
||||
';
|
||||
|
||||
$query->setParameter('id', $siteId);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['siteId' => $siteId])->fetchAllAssociative();
|
||||
|
||||
return $query->getResult();
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$document = new Document();
|
||||
$document->setId($row['id']);
|
||||
$document->setTitle($row['titolo']);
|
||||
$document->setFilename($row['filename']);
|
||||
$document->setDescription($row['descrizione']);
|
||||
$document->setConservationPlace($row['luogo']);
|
||||
$document->setType($row['tipo']);
|
||||
$document->setAuthors($row['autori']);
|
||||
$entities[] = $document;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Document[] Returns an array of Document objects
|
||||
*/
|
||||
public function findByNotConserved(int $notConservedId): array
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
d.id,
|
||||
d.titolo,
|
||||
d.filename,
|
||||
d.descrizione,
|
||||
d.autori,
|
||||
d.tipo,
|
||||
d.luogo
|
||||
FROM documento d
|
||||
INNER JOIN non_conserv_documento sd ON sd.id_documento = d.id
|
||||
WHERE sd.id_non_conserv = :notConservedId
|
||||
ORDER BY d.titolo ASC
|
||||
';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['notConservedId' => $notConservedId])->fetchAllAssociative();
|
||||
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$document = new Document();
|
||||
$document->setId($row['id']);
|
||||
$document->setTitle($row['titolo']);
|
||||
$document->setFilename($row['filename']);
|
||||
$document->setDescription($row['descrizione']);
|
||||
$document->setConservationPlace($row['luogo']);
|
||||
$document->setType($row['tipo']);
|
||||
$document->setAuthors($row['autori']);
|
||||
$entities[] = $document;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Document[] Returns an array of Document objects
|
||||
*/
|
||||
public function findByUnderwater(int $underwaterId): array
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
d.id,
|
||||
d.titolo,
|
||||
d.filename,
|
||||
d.descrizione,
|
||||
d.autori,
|
||||
d.tipo,
|
||||
d.luogo
|
||||
FROM documento d
|
||||
INNER JOIN giacimento_documento gd ON gd.id_documento = d.id
|
||||
WHERE gd.id_giacimento = :underwaterId
|
||||
ORDER BY d.titolo ASC
|
||||
';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$results = $stmt->executeQuery(['underwaterId' => $underwaterId])->fetchAllAssociative();
|
||||
|
||||
$entities = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$document = new Document();
|
||||
$document->setId($row['id']);
|
||||
$document->setTitle($row['titolo']);
|
||||
$document->setFilename($row['filename']);
|
||||
$document->setDescription($row['descrizione']);
|
||||
$document->setConservationPlace($row['luogo']);
|
||||
$document->setType($row['tipo']);
|
||||
$document->setAuthors($row['autori']);
|
||||
$entities[] = $document;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
// /**
|
||||
// * @return Document[] Returns an array of Document objects
|
||||
// */
|
||||
|
||||
135
src/Repository/GeoImageRepository.php
Normal file
135
src/Repository/GeoImageRepository.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\GeoImage;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\DBAL\LockMode;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<GeoImage>
|
||||
*/
|
||||
class GeoImageRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, GeoImage::class);
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function find(mixed $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null): ?object
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = "SELECT
|
||||
id,
|
||||
filename,
|
||||
etichetta as label,
|
||||
ST_AsGeoJSON(poligono) as polygon
|
||||
FROM geo_immagine_catasto
|
||||
WHERE id = :id
|
||||
";
|
||||
|
||||
$result = $conn->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
|
||||
if (! $result) return null;
|
||||
|
||||
$geoImage = new GeoImage();
|
||||
$geoImage->setId($result['id']);
|
||||
$geoImage->setFilename($result['filename']);
|
||||
$geoImage->setPolygon($result['polygon']);
|
||||
$geoImage->setLabel($result['label']);
|
||||
|
||||
return $geoImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all geoimages with associated geometry (polygon)
|
||||
* as GeoJSON
|
||||
* @return GeoImage[]
|
||||
*/
|
||||
public function findAllWithGeometry()
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = "SELECT
|
||||
id,
|
||||
filename,
|
||||
etichetta as label,
|
||||
ST_AsGeoJSON(poligono) as polygon
|
||||
FROM geo_immagine_catasto
|
||||
ORDER BY etichetta ASC
|
||||
";
|
||||
|
||||
$results = $conn->executeQuery($sql)
|
||||
->fetchAllAssociative();
|
||||
|
||||
$entities = [];
|
||||
foreach ($results as $result) {
|
||||
$geoimage = new GeoImage();
|
||||
$geoimage->setId($result['id']);
|
||||
$geoimage->setFilename($result['filename']);
|
||||
$geoimage->setPolygon($result['polygon']);
|
||||
$geoimage->setLabel($result['label']);
|
||||
$entities[] = $geoimage;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
/**
|
||||
* Returns all labels and ids for menu
|
||||
* @return GeoImage[]
|
||||
*/
|
||||
public function findLabelsAndIds()
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = "SELECT
|
||||
id,
|
||||
etichetta as label
|
||||
FROM geo_immagine_catasto
|
||||
ORDER BY etichetta ASC
|
||||
";
|
||||
|
||||
$results = $conn->executeQuery($sql)
|
||||
->fetchAllAssociative();
|
||||
|
||||
$entities = [];
|
||||
foreach ($results as $result) {
|
||||
$geoimage = new GeoImage();
|
||||
$geoimage->setId($result['id']);
|
||||
$geoimage->setLabel($result['label']);
|
||||
$entities[] = $geoimage;
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return GeoImage[] Returns an array of GeoImage objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('g')
|
||||
// ->andWhere('g.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('g.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?GeoImage
|
||||
// {
|
||||
// return $this->createQueryBuilder('g')
|
||||
// ->andWhere('g.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -32,28 +32,4 @@ class NotConservedRepository extends ServiceEntityRepository
|
||||
return $conn->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
}
|
||||
// /**
|
||||
// * @return NotConserved[] Returns an array of NotConserved objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('n')
|
||||
// ->andWhere('n.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('n.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?NotConserved
|
||||
// {
|
||||
// return $this->createQueryBuilder('n')
|
||||
// ->andWhere('n.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
|
||||
59
src/Repository/PrehistoricRepository.php
Normal file
59
src/Repository/PrehistoricRepository.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Prehistoric;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Prehistoric>
|
||||
*/
|
||||
class PrehistoricRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Prehistoric::class);
|
||||
}
|
||||
|
||||
public function coordinates(int $id): array|bool
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
ST_X(ST_AsText(coordinate)) as lng,
|
||||
ST_Y(ST_AsText(coordinate)) as lat
|
||||
FROM
|
||||
preistoria
|
||||
WHERE id = :id
|
||||
';
|
||||
|
||||
return $conn->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
}
|
||||
// /**
|
||||
// * @return Prehistoric[] Returns an array of Prehistoric objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Prehistoric
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
36
src/Repository/ReuseRepository.php
Normal file
36
src/Repository/ReuseRepository.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Reuse;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Finding>
|
||||
*/
|
||||
class ReuseRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Reuse::class);
|
||||
}
|
||||
|
||||
public function coordinates(int $id)
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
ST_X(ST_AsText(coordinate)) as lng,
|
||||
ST_Y(ST_AsText(coordinate)) as lat
|
||||
FROM
|
||||
reimpiego
|
||||
WHERE id = :id
|
||||
';
|
||||
|
||||
return $conn->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
}
|
||||
|
||||
}
|
||||
61
src/Repository/UnderwaterRepository.php
Normal file
61
src/Repository/UnderwaterRepository.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Underwater;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Underwater>
|
||||
*/
|
||||
class UnderwaterRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Underwater::class);
|
||||
}
|
||||
|
||||
public function coordinates(int $id)
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
ST_X(ST_AsText(coordinate)) as lng,
|
||||
ST_Y(ST_AsText(coordinate)) as lat
|
||||
FROM
|
||||
giacimento
|
||||
WHERE id = :id
|
||||
';
|
||||
|
||||
return $conn
|
||||
->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Underwater[] Returns an array of Underwater objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('u.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Underwater
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user