[Symfony2] ContextErrorException: Notice: Undefined property
Bonjour à tous,
Je me suis fait la main concernant les requêtes SQL sur Symfony, j'ai vu comment le tout fonctionne sur un projet à part.
Lorsque j'essaie d'effectué une requête qui permet de visionner la première ligne de ma table voici l'erreur que j'ai :
Code:
ContextErrorException: Notice: Undefined property: Oil\WorksAppBundle\Entity\PartiesCorps::$PC_Libelle in C:\wamp\www\Symfony2\7minutes\src\Oil\WorksAppBundle\Entity\PartiesCorps.php line 69
Et voici ce qu'il y a à cette fameuse ligne 69 :
Code:
1 2 3 4 5 6 7 8 9
| /**
* Get PC_Libelle
*
* @return string
*/
public function getPCLibelle()
{
return $this->PC_Libelle;
} |
Voici la deuxième erreur :
Code:
Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("") in OilWorksAppBundle:WorksApp:test.html.twig at line 9.
Voici le code ma vue test.html.twig :
Code:
1 2 3 4 5 6 7 8 9
| {% block body %}
<div>
{{ PartiesCorps.PCLibelle }}
</div>
<div>
{{ PartiesCorps.PCNbrexo }}
</div>
{% endblock %} |
Et voici la méthode mon controller... :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public function getPartieCorpsAction() {
// On récupère le repository
$repository = $this->getDoctrine()
->getManager()
->getRepository('OilWorksAppBundle:PartiesCorps');
// On récupère l'entité correspondant à l'id $id
$pc = $repository->find('1');
// Ou null si aucun article n'a été trouvé avec l'id $id
if($pc === null)
{
throw $this->createNotFoundException('PartiesCorps[id="1"] inexistant.');
}
return $this->render('OilWorksAppBundle:WorksApp:test.html.twig', array(
'PartiesCorps' => $pc
));
} |
Je ne comprend vraiment pas l'erreur...
Si quelqu'un peut m'éclairer :)