-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathComment.php
More file actions
26 lines (23 loc) · 882 Bytes
/
Comment.php
File metadata and controls
26 lines (23 loc) · 882 Bytes
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
<?php
/**
* @author Serge Kishiko <sergekishiko@gmail.com>
* @copyright (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* @license Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
* @link http://hizup.uk
*/
namespace TestProject\Model;
class Comment extends Blog
{
public function add(array $aData)
{
$oStmt = $this->oDb->prepare('INSERT INTO Comments (idPost, content, authorName, createdDate) VALUES(:id_post, :content, :author_name, :created_date)');
return $oStmt->execute($aData);
}
public function getPostComments($iPostId)
{
$oStmt = $this->oDb->prepare('SELECT * FROM Comments WHERE idPost = :postId');
$oStmt->bindParam(':postId', $iPostId, \PDO::PARAM_INT);
$oStmt->execute();
return $oStmt->fetchAll(\PDO::FETCH_OBJ);
}
}