Bonjour
je suis en train de développer une application web avec Symfony
tous marche bien mais je sais pas pourquoi et comment j'ai cette erreur quand je lance mon site :
voici une partie du controller offre : la fonction pour afficher les dernieres offres
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 An exception has been thrown during the rendering of a template ("Entity was not found.") in "StageSiteBundle:Offre:blockLastOffres.html.twig" at line 37. 500 Internal Server Error - Twig_Error_Runtime
et voici une partie du fichier :blockLastOffres.html.twig :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 public function blockLastOffresAction() { $entityOffre = "StageSiteBundle:Offre"; $entityRecruteur = "StageSiteBundle:Recruteur"; $today = new \DateTime("now"); $em = $this->getDoctrine()->getEntityManager(); $offres = $em->createQuery("SELECT o FROM $entityOffre o where o.dateexpiration > :today and o.deleted = 0 order by o.dateajout desc") ->setParameter('today', $today->format('Y-m-d')) ->setMaxResults(9) ->getResult(); return $this->render('StageSiteBundle:Offre:blockLastOffres.html.twig', array('offres' => $offres)); }
j'ai les entités offre et recruteur et ça marche tres bien mais je sais pas qu'est ce qui se passe parce que je ne modifie plus le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 {% if offres %} {% for offre in offres%} <span class="bloclast" onclick="document.location='{{ url('offre_show', { 'id': offre.id })}}'"> <span class="title2"><a href="{{ path('offre_show', { 'id': offre.id }) }}">{{ offre.titreSmall }}</a></span> <span class="texte2">Date: <font color="#00">{{offre.getDMdate(offre.datedebut)}}</font> au <font color="#00">{{offre.getDMdate(offre.datefin)}}</font> - Ville: <font color="#00">{{ offre.ville.ville }}</font></span> <span class="texte2"> Entreprise: <a href="{{ url('recruteur_show', { 'id': offre.recruteur.id })}}" class="readMore2">{{ offre.recruteur.nom }}</a> | Rénumération: <font color="#00"> {% set found = 0 %} {% if offre.REMUNERATION == 0 %} NON {% set found = 1 %} {% elseif offre.REMUNERATION == 1 %} OUI {% set found = 1 %} {% endif %} {% if found==0%} Aucune information {% endif %} | Convention : OUI </font></span> </span> <img src="{{ asset('bundles/stagesite/images/spacer/lineGrisCond.jpg')}}" class="spacer" /> </span> {% endfor %} {% endif %}
Partager