File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,5 +54,35 @@ public function addComment(Comment $comment)
5454 $ STH ->execute ();
5555 $ comment ->setID ($ this ->DBH ->lastInsertId ());
5656 }
57+
58+ public function getCommentsByNode ($ node )
59+ {
60+
61+ $ STH = $ this ->DBH ->prepare ("SELECT * FROM comments WHERE fileid=:id and path LIKE (:node,'%') ORDER BY path " );
62+ $ STH ->bindValue (":id " , $ id );
63+ $ STH ->bindValue (":node " , $ node );
64+ $ STH ->execute ();
65+ return $ STH ->fetchAll (PDO ::FETCH_CLASS , "comment " );
66+ }
67+
68+ public function deleteComment ($ node )
69+ {
70+ $ STH = $ this ->DBH ->prepare ("DELETE FROM comments WHERE path LIKE (:node,'%') " );
71+ $ STH ->execute ();
72+ }
73+
74+ public function editeComment (Comment $ comment )
75+ {
76+ $ STH = $ this ->DBH ->prepare ("UPDATE comments SET (text)
77+ VALUES (:text) WHERE id:=:id " );
78+
79+ $ STH ->bindvalue (":id " , $ comment ->getID ());
80+ $ STH ->bindvalue (":text " , $ comment ->getText ());
81+
82+
83+ $ STH ->execute ();
84+ $ comment ->setID ($ this ->DBH ->lastInsertId ());
85+ }
86+ }
5787
5888}
You can’t perform that action at this time.
0 commit comments