Merge branch 'master' of https://git.electricmandarine.cloud/nicolo/caprigis-api
This commit is contained in:
commit
e98cbc585b
@ -17,7 +17,7 @@ class FindingController extends AbstractController
|
|||||||
{
|
{
|
||||||
$repo = $em->getRepository(Finding::class);
|
$repo = $em->getRepository(Finding::class);
|
||||||
|
|
||||||
$findings = $repo->findAll();
|
$findings = $repo->findBy([], ['label' => 'ASC']);
|
||||||
|
|
||||||
foreach($findings as $key => $finding) {
|
foreach($findings as $key => $finding) {
|
||||||
$coords = $repo->coordinates($finding->getId());
|
$coords = $repo->coordinates($finding->getId());
|
||||||
|
@ -20,7 +20,7 @@ class NotConservedController extends AbstractController
|
|||||||
//$repoBib = $em->getRepository(Bibliography::class);
|
//$repoBib = $em->getRepository(Bibliography::class);
|
||||||
$repoImg = $em->getRepository(Image::class);
|
$repoImg = $em->getRepository(Image::class);
|
||||||
|
|
||||||
$records = $repo->findBy([], ['id' => 'ASC']);
|
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||||
|
|
||||||
// Terrible? N+1..
|
// Terrible? N+1..
|
||||||
foreach ($records as $key => $record) {
|
foreach ($records as $key => $record) {
|
||||||
|
@ -18,7 +18,7 @@ class PrehistoricController extends AbstractController
|
|||||||
$repo = $em->getRepository(Prehistoric::class);
|
$repo = $em->getRepository(Prehistoric::class);
|
||||||
//$repoBib = $em->getRepository(Bibliography::class);
|
//$repoBib = $em->getRepository(Bibliography::class);
|
||||||
|
|
||||||
$records = $repo->findBy([], ['id' => 'ASC']);
|
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||||
|
|
||||||
// Terrible? N+1..
|
// Terrible? N+1..
|
||||||
foreach ($records as $key => $record) {
|
foreach ($records as $key => $record) {
|
||||||
|
@ -20,30 +20,30 @@ class SiteController extends AbstractController
|
|||||||
{
|
{
|
||||||
$repo = $em->getRepository(Site::class);
|
$repo = $em->getRepository(Site::class);
|
||||||
|
|
||||||
$sites = $repo->findAll();
|
$sites = $repo->findBy([], ['label' => 'ASC']);
|
||||||
|
|
||||||
// TODO N+1...
|
// TODO N+1...
|
||||||
foreach($sites as $key => $site) {
|
foreach($sites as $key => $site) {
|
||||||
$coords = $repo->coordinates($site->getId());
|
$coords = $repo->coordinates($site->getId());
|
||||||
$site->setLat($coords['lat']);
|
$site->setLat($coords['lat']);
|
||||||
$site->setLng($coords['lng']);
|
$site->setLng($coords['lng']);
|
||||||
$sites[$key] = $site;
|
$repoImg = $em->getRepository(Image::class);
|
||||||
$repo = $em->getRepository(Image::class);
|
|
||||||
$images = new ArrayCollection(
|
$images = new ArrayCollection(
|
||||||
$repo->findBy(
|
$repoImg->findBy(
|
||||||
['site' => $site->getId()],
|
['site' => $site->getId()],
|
||||||
['sequence' => 'ASC']
|
['sequence' => 'ASC']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$repo = $em->getRepository(Document::class);
|
$repoDocs = $em->getRepository(Document::class);
|
||||||
$documents = $repo->findBySite($site->getId());
|
$documents = $repoDocs->findBySite($site->getId());
|
||||||
$repo = $em->getRepository(Bibliography::class);
|
$repoBib = $em->getRepository(Bibliography::class);
|
||||||
$bibliography = $repo->findAllBySite($site->getId());
|
$bibliography = $repoBib->findAllBySite($site->getId());
|
||||||
|
|
||||||
$site->setImages($images);
|
$site->setImages($images);
|
||||||
$site->setDocuments($documents);
|
$site->setDocuments($documents);
|
||||||
$site->setBibliography($bibliography);
|
$site->setBibliography($bibliography);
|
||||||
$repo = $em->getRepository(Site::class);
|
|
||||||
|
$sites[$key] = $site;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->json($sites);
|
return $this->json($sites);
|
||||||
|
@ -49,6 +49,12 @@ class Finding implements \JsonSerializable
|
|||||||
#[ORM\Column(length: 40, nullable: true, name: 'misure')]
|
#[ORM\Column(length: 40, nullable: true, name: 'misure')]
|
||||||
private ?string $measurements = null;
|
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 $lat = null;
|
||||||
|
|
||||||
private ?float $lng = null;
|
private ?float $lng = null;
|
||||||
@ -207,6 +213,30 @@ class Finding implements \JsonSerializable
|
|||||||
return $this;
|
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
|
public function getLat(): ?float
|
||||||
{
|
{
|
||||||
return $this->lat;
|
return $this->lat;
|
||||||
@ -269,6 +299,8 @@ class Finding implements \JsonSerializable
|
|||||||
'conservationPlace' => $this->conservationPlace,
|
'conservationPlace' => $this->conservationPlace,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
|
'label' => $this->label,
|
||||||
|
'municipality' => $this->municipality,
|
||||||
'coordinates' => [$this->lat, $this->lng],
|
'coordinates' => [$this->lat, $this->lng],
|
||||||
'bibliography' => $this->bibliography,
|
'bibliography' => $this->bibliography,
|
||||||
'images' => $this->images,
|
'images' => $this->images,
|
||||||
|
@ -45,6 +45,12 @@ class NotConserved implements \JsonSerializable
|
|||||||
#[ORM\Column(name: 'autore_scheda', length: 100, nullable: true)]
|
#[ORM\Column(name: 'autore_scheda', length: 100, nullable: true)]
|
||||||
private ?string $author = null;
|
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
|
* @var Image[] $images
|
||||||
*/
|
*/
|
||||||
@ -170,6 +176,30 @@ class NotConserved implements \JsonSerializable
|
|||||||
return $this;
|
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[]
|
* @return Image[]
|
||||||
*/
|
*/
|
||||||
@ -198,6 +228,8 @@ class NotConserved implements \JsonSerializable
|
|||||||
'period' => $this->period,
|
'period' => $this->period,
|
||||||
'shortDescription' => $this->shortDescription,
|
'shortDescription' => $this->shortDescription,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
|
'municipality' => $this->municipality,
|
||||||
|
'label' => $this->label,
|
||||||
'bibliography' => $this->bibliographies,
|
'bibliography' => $this->bibliographies,
|
||||||
'documents' => $this->documents,
|
'documents' => $this->documents,
|
||||||
'images' => $this->images,
|
'images' => $this->images,
|
||||||
|
@ -33,6 +33,12 @@ class Prehistoric implements \JsonSerializable
|
|||||||
#[ORM\Column(length: 255, nullable: true, name: 'autore_scheda')]
|
#[ORM\Column(length: 255, nullable: true, name: 'autore_scheda')]
|
||||||
private ?string $author = null;
|
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 $lat;
|
||||||
|
|
||||||
private ?float $lng;
|
private ?float $lng;
|
||||||
@ -168,6 +174,30 @@ class Prehistoric implements \JsonSerializable
|
|||||||
return $this;
|
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
|
public function jsonSerialize(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -178,6 +208,8 @@ class Prehistoric implements \JsonSerializable
|
|||||||
'conservation' => $this->conservation,
|
'conservation' => $this->conservation,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
|
'label' => $this->label,
|
||||||
|
'municipality' => $this->municipality,
|
||||||
'coordinates' => [$this->lat, $this->lng],
|
'coordinates' => [$this->lat, $this->lng],
|
||||||
'images' => $this->images,
|
'images' => $this->images,
|
||||||
];
|
];
|
||||||
|
@ -34,6 +34,9 @@ class Underwater implements JsonSerializable
|
|||||||
#[ORM\Column(length: 80, nullable: true, name: 'autore_scheda')]
|
#[ORM\Column(length: 80, nullable: true, name: 'autore_scheda')]
|
||||||
private ?string $author = null;
|
private ?string $author = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 80, nullable: false, name: 'etichetta')]
|
||||||
|
private ?string $label = null;
|
||||||
|
|
||||||
private ?float $lat = null;
|
private ?float $lat = null;
|
||||||
|
|
||||||
private ?float $lng = null;
|
private ?float $lng = null;
|
||||||
@ -122,6 +125,18 @@ class Underwater implements JsonSerializable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLabel(?string $label): static
|
||||||
|
{
|
||||||
|
$this->label = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getLat(): ?float
|
public function getLat(): ?float
|
||||||
{
|
{
|
||||||
return $this->lat;
|
return $this->lat;
|
||||||
@ -157,6 +172,7 @@ class Underwater implements JsonSerializable
|
|||||||
'conservationState' => $this->conservationState,
|
'conservationState' => $this->conservationState,
|
||||||
'shortDescription' => $this->shortDescription,
|
'shortDescription' => $this->shortDescription,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
|
'label' => $this->label,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,74 +22,104 @@ class BibliographyRepository extends ServiceEntityRepository
|
|||||||
*/
|
*/
|
||||||
public function findAllBySite(int $siteId): array
|
public function findAllBySite(int $siteId): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
$conn = $this->getEntityManager()->getConnection();
|
||||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
|
||||||
$query = $this->getEntityManager()->createNativeQuery(
|
$sql = '
|
||||||
'SELECT
|
SELECT
|
||||||
id,
|
b.id,
|
||||||
citazione,
|
b.citazione,
|
||||||
riferimento,
|
b.riferimento,
|
||||||
pagine
|
bs.pagine
|
||||||
FROM bibliografia b
|
FROM bibliografia b
|
||||||
JOIN bibliografia_sito
|
INNER JOIN bibliografia_sito bs ON bs.id_bibliografia = b.id
|
||||||
ON id_bibliografia = b.id
|
WHERE bs.id_sito = :siteId
|
||||||
WHERE id_sito = :id
|
ORDER BY bs.ordine ASC
|
||||||
ORDER BY ordine ASC',
|
';
|
||||||
$rsm
|
|
||||||
);
|
|
||||||
|
|
||||||
$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[]
|
* @return Bibliography[]
|
||||||
*/
|
*/
|
||||||
public function findAllByNotConserved(int $notConserId): array
|
public function findAllByNotConserved(int $notConservedId): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
$conn = $this->getEntityManager()->getConnection();
|
||||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
|
||||||
$query = $this->getEntityManager()->createNativeQuery(
|
$sql = '
|
||||||
'SELECT
|
SELECT
|
||||||
id,
|
b.id,
|
||||||
citazione,
|
b.citazione,
|
||||||
riferimento,
|
b.riferimento,
|
||||||
pagine
|
bs.pagine
|
||||||
FROM bibliografia b
|
FROM bibliografia b
|
||||||
JOIN bibliografia_non_conser
|
INNER JOIN bibliografia_non_conser bs ON bs.id_bibliografia = b.id
|
||||||
ON id_bibliografia = b.id
|
WHERE bs.id_non_conser = :notConservedId
|
||||||
WHERE id_non_conser = :id
|
ORDER BY bs.ordine ASC
|
||||||
ORDER BY ordine ASC',
|
';
|
||||||
$rsm
|
|
||||||
);
|
|
||||||
|
|
||||||
$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[]
|
* @return Bibliography[]
|
||||||
*/
|
*/
|
||||||
public function findAllByFinding(int $findingId): array
|
public function findAllByFinding(int $findingId): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
$conn = $this->getEntityManager()->getConnection();
|
||||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
|
||||||
$query = $this->getEntityManager()->createNativeQuery(
|
$sql = '
|
||||||
'SELECT
|
SELECT
|
||||||
id,
|
b.id,
|
||||||
citazione,
|
b.citazione,
|
||||||
riferimento,
|
b.riferimento,
|
||||||
pagine
|
bs.pagine
|
||||||
FROM bibliografia b
|
FROM bibliografia b
|
||||||
JOIN bibliografia_rinvenim
|
INNER JOIN bibliografia_rinvenim bs ON bs.id_bibliografia = b.id
|
||||||
ON id_bibliografia = b.id
|
WHERE bs.id_rinvenimento = :findingId
|
||||||
WHERE id_rinvenimento = :id
|
ORDER BY bs.ordine ASC
|
||||||
ORDER BY ordine ASC',
|
';
|
||||||
$rsm
|
|
||||||
);
|
|
||||||
|
|
||||||
$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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,28 +22,41 @@ class DocumentRepository extends ServiceEntityRepository
|
|||||||
*/
|
*/
|
||||||
public function findBySite(int $siteId): array
|
public function findBySite(int $siteId): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
$conn = $this->getEntityManager()->getConnection();
|
||||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Document', 'd');
|
|
||||||
$query = $this->getEntityManager()->createNativeQuery(
|
|
||||||
'SELECT
|
|
||||||
id,
|
|
||||||
titolo,
|
|
||||||
filename,
|
|
||||||
descrizione,
|
|
||||||
autori,
|
|
||||||
luogo,
|
|
||||||
tipo
|
|
||||||
FROM documento d
|
|
||||||
JOIN sito_documento
|
|
||||||
ON id_documento = d.id
|
|
||||||
WHERE id_sito = :id
|
|
||||||
',
|
|
||||||
$rsm
|
|
||||||
);
|
|
||||||
|
|
||||||
$query->setParameter('id', $siteId);
|
$sql = '
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.titolo,
|
||||||
|
d.filename,
|
||||||
|
d.descrizione,
|
||||||
|
d.autori,
|
||||||
|
d.tipo,
|
||||||
|
d.luogo
|
||||||
|
FROM documento d
|
||||||
|
INNER JOIN sito_documento sd ON sd.id_documento = d.id
|
||||||
|
WHERE sd.id_sito = :siteId
|
||||||
|
ORDER BY d.titolo ASC
|
||||||
|
';
|
||||||
|
|
||||||
return $query->getResult();
|
$stmt = $conn->prepare($sql);
|
||||||
|
$results = $stmt->executeQuery(['siteId' => $siteId])->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,28 +64,41 @@ class DocumentRepository extends ServiceEntityRepository
|
|||||||
*/
|
*/
|
||||||
public function findByNotConserved(int $notConservedId): array
|
public function findByNotConserved(int $notConservedId): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
$conn = $this->getEntityManager()->getConnection();
|
||||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Document', 'd');
|
|
||||||
$query = $this->getEntityManager()->createNativeQuery(
|
|
||||||
'SELECT
|
|
||||||
id,
|
|
||||||
titolo,
|
|
||||||
filename,
|
|
||||||
descrizione,
|
|
||||||
autori,
|
|
||||||
luogo,
|
|
||||||
tipo
|
|
||||||
FROM documento d
|
|
||||||
JOIN non_conserv_documento
|
|
||||||
ON id_documento = d.id
|
|
||||||
WHERE id_non_conserv = :id
|
|
||||||
',
|
|
||||||
$rsm
|
|
||||||
);
|
|
||||||
|
|
||||||
$query->setParameter('id', $notConservedId);
|
$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
|
||||||
|
';
|
||||||
|
|
||||||
return $query->getResult();
|
$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
|
// * @return Document[] Returns an array of Document objects
|
||||||
|
Loading…
Reference in New Issue
Block a user