src/Controller/DefaultController.php line 16
<?phpnamespace App\Controller;use App\Entity\Fap;use App\Form\FapType;use Doctrine\ORM\EntityManagerInterface;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;class DefaultController extends AbstractController{#[Route('/', name: 'homepage')]public function index(Request $request, EntityManagerInterface $entityManager): Response{$fap = new Fap();$form = $this->createForm(FapType::class, $fap);$form->handleRequest($request);if ($form->isSubmitted()){if ($form->isValid()) {$entityManager->persist($fap);$entityManager->flush();$fap = new Fap();$form = $this->createForm(FapType::class, $fap);$this->addFlash('success', 'FAAAAAPULOUS, we\'re gonna check this gift');}else {$this->addFlash('error', 'An error happened. It could be the file size. The system allows until 2 Mo');}}return $this->render('default/index.html.twig', ['form' => $form->createView(),]);}}