src/Controller/AboutController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\AboutPageData;
  4. use App\Services\AboutService;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class AboutController extends AbstractController
  11. {
  12.     #[Route('/about'name'app_about_us')]
  13.     public function index(EntityManagerInterface $entityManager): Response
  14.     {
  15.         $data $entityManager->getRepository(AboutPageData::class)->find(AboutPageData::ABOUT_DATA_ID);
  16.         return $this->render('about_us/index.html.twig', [
  17.             'data' => $data
  18.         ]);
  19.     }
  20.     #[Route('/about/edit'name'app_about_us_edit')]
  21.     public function EditPage(Request $requestEntityManagerInterface $entityManager)
  22.     {
  23.         $service = new AboutService();
  24.         $service->EditAboutPage($request$entityManager);
  25.         $data $entityManager->getRepository(AboutPageData::class)->find(AboutPageData::ABOUT_DATA_ID);
  26.         return $this->render('about_us/edit_form.html.twig', [
  27.             'data' => $data
  28.         ]);
  29.     }
  30.     #[Route('/about/question'name'app_about_us_ask_question')]
  31.     public function AskQuestion(Request $requestEntityManagerInterface $entityManager)
  32.     {
  33.         $user $this->getUser();
  34.         $service = new AboutService();
  35.         $service->AskQuestion($request$entityManager$user);
  36.         return $this->render('about_us/ask_question_form.html.twig');
  37.     }
  38. }