@@ -59,6 +59,13 @@ class Film
*/
private $note;
+ /**
+ * @var int
+ *
+ * @ORM\Column(name="nb_coms", type="integer", nullable=true)
+ */
+ private $nbComs;
+
/**
* @return \DateTime
@@ -427,6 +434,22 @@ class Film
$this->note = $note;
}
+ * @return int
+ public function getNbComs()
+ {
+ return $this->nbComs;
+ }
+ * @param int $nbComs
+ public function setNbComs($nbComs)
+ $this->nbComs = $nbComs;
@@ -60,6 +60,8 @@
<td>
<a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{ film.titre }}</a>
{% if film.new %}<span class="badge badge-light">New</span>{% endif %}
+ {% if film.nbComs %}<span class="badge badge-light" data-toggle="tooltip" data-original-title="{{ film.nbComs }} commentaire(s)">{{ film.nbComs }}</span>{% endif %}
</td>
{% if film.genres is defined %}
@@ -41,6 +41,7 @@ class NoteMoyenne {
$note = null;
$film->setNote($note);
+ $film->setNbComs(count($commentaires));
$this->em->flush();