convert date error when retrieving data in twig page through doctrine
Posted
by
user201892
on Stack Overflow
See other posts from Stack Overflow
or by user201892
Published on 2012-12-03T16:46:18Z
Indexed on
2012/12/03
17:03 UTC
Read the original article
Hit count: 220
I just find this error when I retrieve all my records on twig page from the database through doctrine
here is my twig code :
{% extends "gestionConferenceApplicationBundle::layout.html.twig" %}
{% block title "Hello " ~ name %}
{% block content %}
je suis un debutant
<table border=2 >
<th>Numéro</th>
<th>Titre</th>
<th>Ville</th>
<th>Lieu</th>
<th>Date de début</th>
<th>Date de fin</th>
{% for item in conferences %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.titre }}</td>
<td>{{ item.ville }}</td>
<td>{{ item.lieu }}</td>*
<td>{{ item.dateDebut }}</td>
<td>{{ item.dateFin }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
the error in the date :
here it is :
An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class DateTime could not be converted to string in C:\wamp\www\Symfony\app\cache\dev\twig\3c\dd\40a703549de9b8769fa40b82230e.php line 72") in gestionConferenceApplicationBundle:acceuil:acceuil.html.twig at line 19.
do you have any idea how to convert this date or any other things
in the MySql I have dateTime field and in doctrine I have :
/**
* @var \DateTime $dateDebut
*
* @ORM\Column(name="date_debut", type="datetime", nullable=false)
*/
private $dateDebut;
© Stack Overflow or respective owner