Use manual hydration for many-to-many to avoid problems with caching
This commit is contained in:
@@ -27,23 +27,23 @@ class SiteController extends AbstractController
|
||||
$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