Merge branch 'master' of https://git.electricmandarine.cloud/nicolo/caprigis-api
This commit is contained in:
commit
042b94f1af
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||
use App\Entity\Site;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Document;
|
||||
use App\Entity\Bibliography;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -32,9 +33,12 @@ class SiteController extends AbstractController
|
||||
);
|
||||
$repo = $em->getRepository(Document::class);
|
||||
$documents = $repo->findBySite($site->getId());
|
||||
$repo = $em->getRepository(Bibliography::class);
|
||||
$bibliography = $repo->findAllBySite($site->getId());
|
||||
|
||||
$site->setImages($images);
|
||||
$site->setDocuments($documents);
|
||||
$site->setBibliography($bibliography);
|
||||
$site->setLat((float) $coords['lat']);
|
||||
$site->setLng((float) $coords['lng']);
|
||||
|
||||
|
@ -26,6 +26,9 @@ class Document implements \JsonSerializable
|
||||
#[ORM\Column(length: 400, nullable: true, name: 'autori')]
|
||||
private ?string $authors = null;
|
||||
|
||||
#[ORM\Column(nullable: true, name: 'luogo')]
|
||||
private ?string $conservationPlace = null;
|
||||
|
||||
#[ORM\Column(length: 20, nullable: true, name: 'tipo')]
|
||||
private ?string $type = null;
|
||||
|
||||
@ -101,6 +104,18 @@ class Document implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConservationPlace(): ?string
|
||||
{
|
||||
return $this->conservationPlace;
|
||||
}
|
||||
|
||||
public function setConservationPlace(?string $conservationPlace): static
|
||||
{
|
||||
$this->conservationPlace = $conservationPlace;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
@ -109,6 +124,7 @@ class Document implements \JsonSerializable
|
||||
'filename' => $this->filename,
|
||||
'description' => $this->description,
|
||||
'authors' => $this->authors,
|
||||
'conservationPlace' => $this->conservationPlace,
|
||||
'type' => $this->type,
|
||||
];
|
||||
}
|
||||
|
@ -21,14 +21,11 @@ class Finding implements \JsonSerializable
|
||||
#[ORM\Column(length: 200, nullable: true, name: 'materia')]
|
||||
private ?string $material = null;
|
||||
|
||||
#[ORM\Column(length: 30, nullable: true, name: 'inventario')]
|
||||
private ?string $inventory = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true, name: 'luogo_rinv')]
|
||||
private ?string $place = null;
|
||||
|
||||
#[ORM\Column(nullable: true, name: 'anno_rinv')]
|
||||
private ?int $year = null;
|
||||
#[ORM\Column(nullable: true, name: 'anno_rinv', length: 40)]
|
||||
private ?string $year = null;
|
||||
|
||||
#[ORM\Column(length: 200, nullable: true, name: 'datazione')]
|
||||
private ?string $dating = null;
|
||||
@ -102,18 +99,6 @@ class Finding implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInventory(): ?string
|
||||
{
|
||||
return $this->inventory;
|
||||
}
|
||||
|
||||
public function setInventory(?string $inventory): static
|
||||
{
|
||||
$this->inventory = $inventory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlace(): ?string
|
||||
{
|
||||
return $this->place;
|
||||
@ -126,12 +111,12 @@ class Finding implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getYear(): ?int
|
||||
public function getYear(): ?string
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
|
||||
public function setYear(?int $year): static
|
||||
public function setYear(?string $year): static
|
||||
{
|
||||
$this->year = $year;
|
||||
|
||||
@ -277,7 +262,6 @@ class Finding implements \JsonSerializable
|
||||
'object' => $this->object,
|
||||
'material' => $this->material,
|
||||
'measurements' => $this->measurements,
|
||||
'inventory' => $this->inventory,
|
||||
'place' => $this->place,
|
||||
'year' => $this->year,
|
||||
'dating' => $this->dating,
|
||||
|
@ -74,14 +74,28 @@ class Site implements JsonSerializable
|
||||
#[ORM\Column(name: 'loc_generica', length: 200, nullable: true)]
|
||||
private ?string $genericPlace = null;
|
||||
|
||||
#[ORM\Column(name: 'tecniche_ed', nullable: true)]
|
||||
private ?string $techniques = null;
|
||||
|
||||
#[ORM\Column(name: 'autore_scheda', nullable: true)]
|
||||
private ?string $author = null;
|
||||
|
||||
private ?float $lat;
|
||||
|
||||
private ?float $lng;
|
||||
|
||||
private ?ArrayCollection $images;
|
||||
|
||||
/**
|
||||
* @var Document[] $documents
|
||||
*/
|
||||
private ?array $documents;
|
||||
|
||||
/**
|
||||
* @var Bibliography[] $bibliography
|
||||
*/
|
||||
private ?array $bibliography;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@ -322,6 +336,30 @@ class Site implements JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTechniques(): ?string
|
||||
{
|
||||
return $this->techniques;
|
||||
}
|
||||
|
||||
public function setTechniques(string $techniques): static
|
||||
{
|
||||
$this->techniques = $techniques;
|
||||
|
||||
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;
|
||||
@ -368,6 +406,18 @@ class Site implements JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBibliography(): ?array
|
||||
{
|
||||
return $this->bibliography;
|
||||
}
|
||||
|
||||
public function setBibliography(array $bibliography): static
|
||||
{
|
||||
$this->bibliography = $bibliography;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
@ -394,6 +444,9 @@ class Site implements JsonSerializable
|
||||
'ownedBy' => $this->ownedBy,
|
||||
'images' => $this->images->toArray(),
|
||||
'documents' => $this->documents,
|
||||
'bibliography' => $this->bibliography,
|
||||
'techniques' => $this->techniques,
|
||||
'author' => $this->author,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,31 @@ class BibliographyRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, Bibliography::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
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
|
||||
FROM bibliografia b
|
||||
JOIN bibliografia_sito
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_sito = :id
|
||||
ORDER BY ordine ASC',
|
||||
$rsm
|
||||
);
|
||||
|
||||
$query->setParameter('id', $siteId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
|
@ -31,6 +31,7 @@ class DocumentRepository extends ServiceEntityRepository
|
||||
filename,
|
||||
descrizione,
|
||||
autori,
|
||||
luogo,
|
||||
tipo
|
||||
FROM documento d
|
||||
JOIN sito_documento
|
||||
|
Loading…
Reference in New Issue
Block a user