src/Controller/Frontend/VisualisasiController.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use App\Controller\Base\BaseController;
  4. use App\Entity\TVisualisasi;
  5. use App\Repository\TVisualisasiRepository;
  6. use Knp\Component\Pager\PaginatorInterface;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Sonata\SeoBundle\Seo\SeoPageInterface;
  11. class VisualisasiController extends BaseController
  12. {
  13.     /**
  14.      * @Route("/visualisasi", name="visualisasi", methods={"POST", "GET"})
  15.      */
  16.     public function index(SeoPageInterface $seoPageTVisualisasiRepository $tVisualisasiRepository,
  17.     PaginatorInterface $paginatorInterfaceRequest $request): Response
  18.     {
  19.         $seoPage->addTitlePrefix("Visualisasi");
  20.         $queryBuilder $this->getQueryBuilder(TVisualisasi::class);
  21.         $pagination $paginatorInterface->paginate($queryBuilder$request->query->getInt('page'1), 10);
  22.         $data_visualisasi $tVisualisasiRepository->findAll();
  23.         return $this->render('frontend/visualisasi/index.html.twig', [
  24.             'controller_name' => 'VisualisasiController',
  25.             'data' => $data_visualisasi,
  26.             'pagination' => $pagination,
  27.         ]);
  28.     }
  29.      /**
  30.      * @Route("/visualisasi/detail/{id}.html", name="detail_visualisasi", methods={"GET"})
  31.      */
  32.     public function detail(?string $idTVisualisasiRepository $tVisualisasiRepo): Response
  33.     {
  34.         $visualisasi $tVisualisasiRepo->find($id);
  35.         // dump($visualisasi); exit;
  36.         $entityManager $this->getDoctrine()->getManager();
  37.         $entityManager->persist($visualisasi);
  38.         $entityManager->flush();
  39.         return $this->render('frontend/visualisasi/detail.html.twig', [
  40.             'header_kategori' => $this->getHeaderKategori(),
  41.             'visualisasi' => $visualisasi,
  42.         ]);
  43.     }
  44. }