I’m in trouble and I need some help.
I’m currently working on Symfony 5.4 and I’m trying to make a dynamic landing page for a customer. I wanted to make the landing easily editable for the customer so he doesn’t need to write inside the home.html.twig. So I did a LandingPage entity with five textfields and five images.
I also did a LandingPageType, a LandingPageRepository and everything is controlled in the HomeController.
The thing is, I don't know how to fetch the textfield's DB values when editing with this type of configuration since there are no ID for each textfield.
Here's my edit function :
public function landingEdit(Request $request, LandingPageRepository $landingPageRepository): Response
{
$landingPage = new LandingPage();
$form = $this->createForm(LandingPageType::class, $landingPage);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$landingPageRepository->add($landingPage);
return $this->redirectToRoute('app_admin_panel', [], Response::HTTP_SEE_OTHER);
}
return $this->renderForm('admin_panel/content/pages/landing.html.twig', [
'landing' => $landingPage,
'form' => $form,
]);
}
If someone has an idea, that'd be awesome !
Thanks in advance!