Add collection and new vocab + mess with repository
This commit is contained in:
26
src/Controller/CollectionController.php
Normal file
26
src/Controller/CollectionController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Collection;
|
||||
use App\Entity\Bibliography;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class CollectionController extends AbstractController
|
||||
{
|
||||
#[Route('/collection/{id<\d+>}', name: 'app_collection')]
|
||||
public function index(Collection $collection, EntityManagerInterface $em): Response
|
||||
{
|
||||
$bibliographies = $em->getRepository(Bibliography::class)->findAllCollection($collection->getId());
|
||||
|
||||
$collection->setBibliographies($bibliographies);
|
||||
|
||||
return $this->render('collection/index.html.twig', [
|
||||
'controller_name' => 'CollectionController',
|
||||
'record' => $collection,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user