Merge branch 'master' of https://git.electricmandarine.cloud/nicolo/caprigis-api
This commit is contained in:
@@ -17,7 +17,7 @@ class FindingController extends AbstractController
|
||||
{
|
||||
$repo = $em->getRepository(Finding::class);
|
||||
|
||||
$findings = $repo->findAll();
|
||||
$findings = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
foreach($findings as $key => $finding) {
|
||||
$coords = $repo->coordinates($finding->getId());
|
||||
|
||||
@@ -20,7 +20,7 @@ class NotConservedController extends AbstractController
|
||||
//$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) {
|
||||
|
||||
@@ -18,7 +18,7 @@ class PrehistoricController extends AbstractController
|
||||
$repo = $em->getRepository(Prehistoric::class);
|
||||
//$repoBib = $em->getRepository(Bibliography::class);
|
||||
|
||||
$records = $repo->findBy([], ['id' => 'ASC']);
|
||||
$records = $repo->findBy([], ['label' => 'ASC']);
|
||||
|
||||
// Terrible? N+1..
|
||||
foreach ($records as $key => $record) {
|
||||
|
||||
@@ -20,30 +20,30 @@ class SiteController extends AbstractController
|
||||
{
|
||||
$repo = $em->getRepository(Site::class);
|
||||
|
||||
$sites = $repo->findAll();
|
||||
$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']);
|
||||
$sites[$key] = $site;
|
||||
$repo = $em->getRepository(Image::class);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
$images = new ArrayCollection(
|
||||
$repo->findBy(
|
||||
$repoImg->findBy(
|
||||
['site' => $site->getId()],
|
||||
['sequence' => 'ASC']
|
||||
)
|
||||
);
|
||||
$repo = $em->getRepository(Document::class);
|
||||
$documents = $repo->findBySite($site->getId());
|
||||
$repo = $em->getRepository(Bibliography::class);
|
||||
$bibliography = $repo->findAllBySite($site->getId());
|
||||
$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);
|
||||
$repo = $em->getRepository(Site::class);
|
||||
|
||||
$sites[$key] = $site;
|
||||
}
|
||||
|
||||
return $this->json($sites);
|
||||
|
||||
Reference in New Issue
Block a user