src/Controller/ClientController.php line 21

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Client;
  4. use App\Entity\Project;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. /**
  10.  * @Route("/client")
  11.  */
  12. class ClientController extends AbstractController
  13. {
  14.     public function __construct(private readonly EntityManagerInterface $em) {}
  15.     /**
  16.      * @Route("/{slug}", name="client_page")
  17.      */
  18.     public function show(Client $client): Response
  19.     {
  20.         $projects $this->em->getRepository(Project::class)->findBy(
  21.             ['client' => $client],
  22.             ['displayOrder' => 'ASC']
  23.         );
  24.         return $this->render('project/index_topic.html.twig', [
  25.             'topic' => $client,
  26.             'projects' => $projects,
  27.         ]);
  28.     }
  29. }