Add landing for collection + bidirectional many-to-many (biblio-coll)

This commit is contained in:
2024-11-05 11:03:35 +01:00
parent a2f518ee15
commit 67c73e9349
5 changed files with 449 additions and 345 deletions

View File

@@ -24,4 +24,20 @@ class CollectionController extends AbstractController
'record' => $collection,
]);
}
#[Route('/collection', name: 'app_collection_landing')]
public function landing(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Collection::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']);
$count = count($records);
$records = array_slice($records, 0, 15);
return $this->render('collection/landing.html.twig', [
'controller_name' => 'CollectionController',
'records' => $records,
'count' => $count,
]);
}
}

View File

@@ -45,7 +45,7 @@ class Bibliography
#[ORM\JoinTable(name: 'rel_riferimento_collezione')]
#[ORM\JoinColumn(name: 'Bibliografia_id_bib', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'Collezione_id_coll', referencedColumnName: 'id')]
#[ORM\ManyToMany(targetEntity: Collection::class)]
#[ORM\ManyToMany(targetEntity: Collection::class, inversedBy: 'bibliography')]
private DoctrineCollection $collections;
private DoctrineCollection $documents;