php - Symfony Twig variable not recognized (Variable does not exist)

This was working fine hours ago, I get data from database and simply display it in a table in Twig. This is the controller from where I get the instance of the variable having my entity "Cours"
/**
* @Route("/listeCours", name="liste_cours")
*/
public function index()
{
$lstCours = $this->getDoctrine()
->getRepository('App:Cours')
->findAll();
return $this->render('liste_cours/index.html.twig', ['lstCours' => $lstCours]);
}
I saved data from the repository for the entity "Cours" in the variable "lstCours" which is the one I will call later in twig here,
{% for cours in lstCours %}
<tr>
<td>{{ cours.nom }}</td>
<td>{{ cours.type }}</td>
<td>{{ cours.description }}</td>
<td>{{ cours.prix }}</td>
<td>
<button class="btn_apt btn"><a href="">Ajouter</a></button>
</td>
</tr>
Compiler keep showing an exception saying the variable (lstCours) does not exist.
Thank you in advance.
Answer
Solution:
When you want to debug your Twig context, you can use:
{{ dump(_context) }}
It will show you all available variables in your template.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to undefined function illuminate\encryption\openssl_cipher_iv_length()
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.