Compare commits
10 Commits
e98cbc585b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fc6977362 | |||
| 386653b6bf | |||
| f35be9c845 | |||
| f91d88e04c | |||
| eabb619d90 | |||
| 875ca03568 | |||
| 660d409093 | |||
| b446c66fd6 | |||
| 42e32952d6 | |||
| 72af052651 |
90
composer.lock
generated
90
composer.lock
generated
@@ -347,16 +347,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/doctrine-bundle",
|
"name": "doctrine/doctrine-bundle",
|
||||||
"version": "2.13.0",
|
"version": "2.13.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/DoctrineBundle.git",
|
"url": "https://github.com/doctrine/DoctrineBundle.git",
|
||||||
"reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563"
|
"reference": "2740ad8b8739b39ab37d409c972b092f632b025a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/ca59d84b8e63143ce1aed90cdb333ba329d71563",
|
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/2740ad8b8739b39ab37d409c972b092f632b025a",
|
||||||
"reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563",
|
"reference": "2740ad8b8739b39ab37d409c972b092f632b025a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -370,7 +370,7 @@
|
|||||||
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
||||||
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
||||||
"symfony/deprecation-contracts": "^2.1 || ^3",
|
"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/framework-bundle": "^5.4 || ^6.0 || ^7.0",
|
||||||
"symfony/polyfill-php80": "^1.15",
|
"symfony/polyfill-php80": "^1.15",
|
||||||
"symfony/service-contracts": "^1.1.1 || ^2.0 || ^3"
|
"symfony/service-contracts": "^1.1.1 || ^2.0 || ^3"
|
||||||
@@ -447,7 +447,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/DoctrineBundle/issues",
|
"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": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -463,7 +463,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-09-01T09:46:40+00:00"
|
"time": "2024-11-08T23:27:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/doctrine-migrations-bundle",
|
"name": "doctrine/doctrine-migrations-bundle",
|
||||||
@@ -1746,16 +1746,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v7.1.7",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a"
|
"reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a",
|
"url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5",
|
||||||
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a",
|
"reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1819,7 +1819,7 @@
|
|||||||
"terminal"
|
"terminal"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/console/tree/v7.1.7"
|
"source": "https://github.com/symfony/console/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -1835,20 +1835,20 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-11-05T15:34:55+00:00"
|
"time": "2024-11-06T14:23:19+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/dependency-injection",
|
"name": "symfony/dependency-injection",
|
||||||
"version": "v7.1.6",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/dependency-injection.git",
|
"url": "https://github.com/symfony/dependency-injection.git",
|
||||||
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd"
|
"reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
|
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e4d13f0f394f4d02a041ff76acd31c5a20a5f70b",
|
||||||
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
|
"reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1899,7 +1899,7 @@
|
|||||||
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.6"
|
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -1915,7 +1915,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-10-25T15:11:02+00:00"
|
"time": "2024-11-09T09:16:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
@@ -2745,16 +2745,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-foundation",
|
"name": "symfony/http-foundation",
|
||||||
"version": "v7.1.7",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/http-foundation.git",
|
"url": "https://github.com/symfony/http-foundation.git",
|
||||||
"reference": "5183b61657807099d98f3367bcccb850238b17a9"
|
"reference": "f4419ec69ccfc3f725a4de7c20e4e57626d10112"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5183b61657807099d98f3367bcccb850238b17a9",
|
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/f4419ec69ccfc3f725a4de7c20e4e57626d10112",
|
||||||
"reference": "5183b61657807099d98f3367bcccb850238b17a9",
|
"reference": "f4419ec69ccfc3f725a4de7c20e4e57626d10112",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2764,12 +2764,12 @@
|
|||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"doctrine/dbal": "<3.6",
|
"doctrine/dbal": "<3.6",
|
||||||
"symfony/cache": "<6.4"
|
"symfony/cache": "<6.4.12|>=7.0,<7.1.5"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/dbal": "^3.6|^4",
|
"doctrine/dbal": "^3.6|^4",
|
||||||
"predis/predis": "^1.1|^2.0",
|
"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/dependency-injection": "^6.4|^7.0",
|
||||||
"symfony/expression-language": "^6.4|^7.0",
|
"symfony/expression-language": "^6.4|^7.0",
|
||||||
"symfony/http-kernel": "^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",
|
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/http-foundation/tree/v7.1.7"
|
"source": "https://github.com/symfony/http-foundation/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2818,20 +2818,20 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-11-06T09:02:46+00:00"
|
"time": "2024-11-09T09:16:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-kernel",
|
"name": "symfony/http-kernel",
|
||||||
"version": "v7.1.7",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/http-kernel.git",
|
"url": "https://github.com/symfony/http-kernel.git",
|
||||||
"reference": "7f137cda31fd41e422edcdc01915f2c095b84399"
|
"reference": "33fef24e3dc79d6d30bf4936531f2f4bd2ca189e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/7f137cda31fd41e422edcdc01915f2c095b84399",
|
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/33fef24e3dc79d6d30bf4936531f2f4bd2ca189e",
|
||||||
"reference": "7f137cda31fd41e422edcdc01915f2c095b84399",
|
"reference": "33fef24e3dc79d6d30bf4936531f2f4bd2ca189e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2916,7 +2916,7 @@
|
|||||||
"description": "Provides a structured process for converting a Request into a Response",
|
"description": "Provides a structured process for converting a Request into a Response",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/http-kernel/tree/v7.1.7"
|
"source": "https://github.com/symfony/http-kernel/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2932,7 +2932,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-11-06T09:54:34+00:00"
|
"time": "2024-11-13T14:25:32+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-intl-grapheme",
|
"name": "symfony/polyfill-intl-grapheme",
|
||||||
@@ -3556,16 +3556,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/string",
|
"name": "symfony/string",
|
||||||
"version": "v7.1.6",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/string.git",
|
"url": "https://github.com/symfony/string.git",
|
||||||
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626"
|
"reference": "591ebd41565f356fcd8b090fe64dbb5878f50281"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/string/zipball/61b72d66bf96c360a727ae6232df5ac83c71f626",
|
"url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281",
|
||||||
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626",
|
"reference": "591ebd41565f356fcd8b090fe64dbb5878f50281",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3623,7 +3623,7 @@
|
|||||||
"utf8"
|
"utf8"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/string/tree/v7.1.6"
|
"source": "https://github.com/symfony/string/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3639,20 +3639,20 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-09-25T14:20:29+00:00"
|
"time": "2024-11-13T13:31:21+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/var-dumper",
|
"name": "symfony/var-dumper",
|
||||||
"version": "v7.1.7",
|
"version": "v7.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/var-dumper.git",
|
"url": "https://github.com/symfony/var-dumper.git",
|
||||||
"reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1"
|
"reference": "7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f6ea51f669760cacd7464bf7eaa0be87b8072db1",
|
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8",
|
||||||
"reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1",
|
"reference": "7bb01a47b1b00428d32b5e7b4d3b2d1aa58d3db8",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3706,7 +3706,7 @@
|
|||||||
"dump"
|
"dump"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/var-dumper/tree/v7.1.7"
|
"source": "https://github.com/symfony/var-dumper/tree/v7.1.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3722,7 +3722,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-11-05T15:34:55+00:00"
|
"time": "2024-11-08T15:46:42+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/var-exporter",
|
"name": "symfony/var-exporter",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class FindingController extends AbstractController
|
|||||||
public function index(EntityManagerInterface $em): JsonResponse
|
public function index(EntityManagerInterface $em): JsonResponse
|
||||||
{
|
{
|
||||||
$repo = $em->getRepository(Finding::class);
|
$repo = $em->getRepository(Finding::class);
|
||||||
|
$imgRepo = $em->getRepository(Image::class);
|
||||||
|
|
||||||
$findings = $repo->findBy([], ['label' => 'ASC']);
|
$findings = $repo->findBy([], ['label' => 'ASC']);
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ class FindingController extends AbstractController
|
|||||||
$coords = $repo->coordinates($finding->getId());
|
$coords = $repo->coordinates($finding->getId());
|
||||||
$finding->setLat($coords['lat']);
|
$finding->setLat($coords['lat']);
|
||||||
$finding->setLng($coords['lng']);
|
$finding->setLng($coords['lng']);
|
||||||
|
// TODO N + 1!!
|
||||||
|
$images = $imgRepo->findBy(
|
||||||
|
['finding' => $finding->getId()],
|
||||||
|
['sequence' => 'ASC']
|
||||||
|
);
|
||||||
|
$finding->setImages($images);
|
||||||
$findings[$key] = $finding;
|
$findings[$key] = $finding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
|
|
||||||
class GeoImageController extends AbstractController
|
class GeoImageController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/geoimage', name: 'app_geo_image')]
|
#[Route('/geoimages', name: 'app_geo_images')]
|
||||||
public function index(EntityManagerInterface $em): JsonResponse
|
public function index(EntityManagerInterface $em): JsonResponse
|
||||||
{
|
{
|
||||||
$repo = $em->getRepository(GeoImage::class);
|
$repo = $em->getRepository(GeoImage::class);
|
||||||
@@ -18,4 +18,19 @@ class GeoImageController extends AbstractController
|
|||||||
|
|
||||||
return $this->json($geoImages);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Document;
|
||||||
|
use App\Entity\Image;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
@@ -14,15 +16,48 @@ class UnderwaterController extends AbstractController
|
|||||||
public function index(EntityManagerInterface $em): JsonResponse
|
public function index(EntityManagerInterface $em): JsonResponse
|
||||||
{
|
{
|
||||||
$repo = $em->getRepository(Underwater::class);
|
$repo = $em->getRepository(Underwater::class);
|
||||||
|
$imgRepo = $em->getRepository(Image::class);
|
||||||
|
|
||||||
$underwater = $repo->findAll();
|
$underwater = $repo->findAll();
|
||||||
|
|
||||||
foreach ($underwater as $under) {
|
/**
|
||||||
$coords = $repo->coordinates($under->getId());
|
* @var Underwater $record
|
||||||
$under->setLat($coords['lat']);
|
*/
|
||||||
$under->setLng($coords['lng']);
|
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]);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ class GeoImage implements JsonSerializable
|
|||||||
#[ORM\Column(type: Types::JSON, name: 'poligono')]
|
#[ORM\Column(type: Types::JSON, name: 'poligono')]
|
||||||
private ?string $polygon = null;
|
private ?string $polygon = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 60, name: 'etichetta')]
|
||||||
|
private ?string $label = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@@ -58,11 +61,25 @@ class GeoImage implements JsonSerializable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->polygon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLabel(string $label): static
|
||||||
|
{
|
||||||
|
$this->label = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function jsonSerialize(): mixed
|
public function jsonSerialize(): mixed
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
'filename' => $this->filename,
|
'filename' => $this->filename,
|
||||||
'polygon' => $this->polygon,
|
'polygon' => $this->polygon,
|
||||||
|
'label' => $this->label,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ class Image implements \JsonSerializable
|
|||||||
#[ORM\Column(name: 'affioramento', type: Types::BIGINT, nullable: true)]
|
#[ORM\Column(name: 'affioramento', type: Types::BIGINT, nullable: true)]
|
||||||
private ?string $prehistoric = null;
|
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)]
|
#[ORM\Column(name: 'ordine', type: Types::SMALLINT)]
|
||||||
private ?int $sequence = null;
|
private ?int $sequence = null;
|
||||||
|
|
||||||
@@ -139,6 +145,30 @@ class Image implements \JsonSerializable
|
|||||||
return $this;
|
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
|
public function getSequence(): ?int
|
||||||
{
|
{
|
||||||
return $this->sequence;
|
return $this->sequence;
|
||||||
|
|||||||
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,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,16 @@ class Underwater implements JsonSerializable
|
|||||||
|
|
||||||
private ?float $lng = null;
|
private ?float $lng = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Image[] $images
|
||||||
|
*/
|
||||||
|
private ?array $images = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Document[] $documents
|
||||||
|
*/
|
||||||
|
private ?array $documents = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@@ -161,6 +171,30 @@ class Underwater implements JsonSerializable
|
|||||||
return $this;
|
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
|
public function jsonSerialize(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -173,6 +207,8 @@ class Underwater implements JsonSerializable
|
|||||||
'shortDescription' => $this->shortDescription,
|
'shortDescription' => $this->shortDescription,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
'label' => $this->label,
|
'label' => $this->label,
|
||||||
|
'images' => $this->images,
|
||||||
|
'documents' => $this->documents,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ enum ImageType: string
|
|||||||
case Photo = 'foto';
|
case Photo = 'foto';
|
||||||
case Survey = 'rilievo';
|
case Survey = 'rilievo';
|
||||||
case Video = 'video';
|
case Video = 'video';
|
||||||
|
case Reconstruction = '3d';
|
||||||
}
|
}
|
||||||
@@ -120,6 +120,41 @@ class BibliographyRepository extends ServiceEntityRepository
|
|||||||
$entities[] = $biblio;
|
$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;
|
return $entities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,48 @@ class DocumentRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
return $entities;
|
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
|
// * @return Document[] Returns an array of Document objects
|
||||||
// */
|
// */
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ namespace App\Repository;
|
|||||||
|
|
||||||
use App\Entity\GeoImage;
|
use App\Entity\GeoImage;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\DBAL\LockMode;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends ServiceEntityRepository<GeoImage>
|
* @extends ServiceEntityRepository<GeoImage>
|
||||||
@@ -16,6 +18,34 @@ class GeoImageRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, GeoImage::class);
|
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)
|
* Returns all geoimages with associated geometry (polygon)
|
||||||
* as GeoJSON
|
* as GeoJSON
|
||||||
@@ -28,8 +58,10 @@ class GeoImageRepository extends ServiceEntityRepository
|
|||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
id,
|
id,
|
||||||
filename,
|
filename,
|
||||||
|
etichetta as label,
|
||||||
ST_AsGeoJSON(poligono) as polygon
|
ST_AsGeoJSON(poligono) as polygon
|
||||||
FROM geo_immagine_catasto
|
FROM geo_immagine_catasto
|
||||||
|
ORDER BY etichetta ASC
|
||||||
";
|
";
|
||||||
|
|
||||||
$results = $conn->executeQuery($sql)
|
$results = $conn->executeQuery($sql)
|
||||||
@@ -41,6 +73,35 @@ class GeoImageRepository extends ServiceEntityRepository
|
|||||||
$geoimage->setId($result['id']);
|
$geoimage->setId($result['id']);
|
||||||
$geoimage->setFilename($result['filename']);
|
$geoimage->setFilename($result['filename']);
|
||||||
$geoimage->setPolygon($result['polygon']);
|
$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;
|
$entities[] = $geoimage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,28 +32,4 @@ class NotConservedRepository extends ServiceEntityRepository
|
|||||||
return $conn->executeQuery($sql, ['id' => $id])
|
return $conn->executeQuery($sql, ['id' => $id])
|
||||||
->fetchAssociative();
|
->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()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user