Add images to prehistoric
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Prehistoric;
|
||||
//use App\Entity\Bibliography;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -24,6 +25,14 @@ class PrehistoricController extends AbstractController
|
||||
$id = $record->getId();
|
||||
$record->setLat($repo->coordinates($id)['lat']);
|
||||
$record->setLng($repo->coordinates($id)['lng']);
|
||||
$repoImg = $em->getRepository(Image::class);
|
||||
|
||||
$images = $repoImg->findBy(
|
||||
['prehistoric' => $record->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$record->setImages($images);
|
||||
$records[$key] = $record;
|
||||
}
|
||||
|
||||
@@ -46,6 +55,14 @@ class PrehistoricController extends AbstractController
|
||||
|
||||
$prehistoric->setLat($coordinates['lat']);
|
||||
$prehistoric->setLng($coordinates['lng']);
|
||||
$repo = $em->getRepository(Image::class);
|
||||
|
||||
$images = $repo->findBy(
|
||||
['prehistoric' => $prehistoric->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$prehistoric->setImages($images);
|
||||
|
||||
return $this->json($prehistoric);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user