Documents for not conserved
This commit is contained in:
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -17,6 +18,7 @@ class NotConservedController extends AbstractController
|
||||
{
|
||||
$repo = $em->getRepository(NotConserved::class);
|
||||
//$repoBib = $em->getRepository(Bibliography::class);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
|
||||
$records = $repo->findBy([], ['id' => 'ASC']);
|
||||
|
||||
@@ -27,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;
|
||||
}
|
||||
|
||||
@@ -45,8 +53,10 @@ 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']);
|
||||
@@ -58,8 +68,6 @@ class NotConservedController extends AbstractController
|
||||
|
||||
$notConserved->setImages($images);
|
||||
|
||||
return $this->json(
|
||||
$notConserved,
|
||||
);
|
||||
return $this->json($notConserved);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user