Subversion Repository Public Repository

Nextrek

Diff Revisions 415 vs 423 for /Android/SmartCharging/endPoints/nightly/repositories/CommentRepository.php

Diff revisions: vs.
  @@ -74,7 +74,7 @@
74 74 try {
75 75 $query = $this->db->query($sqlComments);
76 76
77 - if (!$query) return null;
77 + if (!$query || $query->rowCount()==0) return $comment_list;
78 78
79 79 $rows = $query->fetchAll(PDO::FETCH_ASSOC);
80 80
  @@ -82,10 +82,11 @@
82 82 array_push($comment_id_list, $row["id"]);
83 83 }
84 84
85 - $sqlImgs = "SELECT commenti.id AS id_commento, id_locale, id_user, voto, descrizione, data, img
86 - FROM commenti
87 - LEFT JOIN immagini_commenti ON commenti.id=immagini_commenti.id_commento
88 - AND commenti.id IN (".implode(",", $comment_id_list).")";
85 + $sqlImgs = "SELECT c.id AS id_commento, id_locale, id_user, voto, descrizione, data, img, username
86 + FROM commenti as c
87 + LEFT JOIN immagini_commenti as i ON c.id=i.id_commento
88 + JOIN utente as u ON c.id_user=u.id
89 + WHERE c.id IN (".implode(",", $comment_id_list).")";
89 90
90 91 //echo "<br/>".$sqlImgs."<br/>";
91 92
  @@ -106,6 +107,7 @@
106 107 $new_comment->id = $comment_id;
107 108 $new_comment->id_locale = $id_local;
108 109 $new_comment->id_user = $row["id_user"];
110 + $new_comment->username = $row["username"];
109 111 $new_comment->voto = $row["voto"];
110 112 $new_comment->descrizione = $row["descrizione"];
111 113 $new_comment->data = $row["data"];