Symfony 5 using form data to update template

Using Symfony 5 I have a controller that retrieves a number of clients from the database. I would like to display these in a table. Currently my controller has this outline:

public function findClients(Request $request)
{   
    // set up form
    
    if ($form->isSubmitted() && $form->isValid()) {

        // get array of clients from database, $clientsArray
        
    }
        
    return $this->render('/findClient.html.twig', [
        'form' => $form->createView()
    ]);
}

Once I have $clientsArray, how do I send this information back to my webpage and how would the template handle this? Or do I redirect to a new controller and template?

Many thanks in advance for the help.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *