本文整理汇总了PHP中Comment::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::setId方法的具体用法?PHP Comment::setId怎么用?PHP Comment::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::setId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAll
/**
* @return array
*/
public static function loadAll()
{
$dbWrapper = new DatabaseWrapper();
$connection = $dbWrapper->getConnection();
$query = "SELECT * FROM temos;";
$temos = [];
foreach ($connection->query($query) as $row) {
$tema = new Tema($connection);
$tema->setId($row['id']);
$tema->setDate($row['subject_date']);
$tema->setName($row['name']);
$query = 'SELECT * FROM comments INNER JOIN temos ON comments.subjectId = ' . $row['id'] . " AND temos.id = " . $row['id'] . ";";
$comments = [];
foreach ($connection->query($query) as $i) {
$comment = new Comment($connection);
$comment->setId($i['id']);
$comment->setsubjectId($i['subjectId']);
$comment->setText($i['text']);
$comment->setDate($i['date']);
$comment->setAuthor($i['author']);
$comments[] = $comment;
}
foreach ($comments as $comment) {
$tema->setComments($comment);
}
$temos[] = $tema;
}
return $temos;
}
示例2: testDeleteWithWrongValues
/**
* Test
*
* @return void
*/
public function testDeleteWithWrongValues()
{
$configuration = Registry::get('Application')->getConfig();
if ($configuration['db']['driver'] == 'pdo_mysql') {
$this->markTestSkipped('Mysql does not thrown exception.');
}
$this->setExpectedException('Gc\\Exception');
$this->object->setId('undefined');
$this->assertFalse($this->object->delete());
}
示例3: testPut
public function testPut()
{
$comment = new Comment();
$comment->setId(50);
$comment->setContent('Très bien');
$comment->setPostDate('2012-12-21 00:00:00');
$comment->setIdUser(1);
$comment->setIdAnnouncement(10);
$commentMapper = new CommentMapper();
$commentMapper->setId(50);
$commentMapper->updateComment($comment);
$this->assertEquals($comment, $commentMapper->selectComment());
}
示例4: findCommentById
public function findCommentById($id)
{
$stmt = $this->dtb->prepare('SELECT * FROM comments WHERE postID = :pid');
$stmt->bindValue(':pid', $pid, PDO::PARAM_INT);
$stmt->execute();
$data = array();
$um = new PdoUserManager();
$pm = new PdoPostManager();
$d = $stmt->fetch(PDO::FETCH_OBJ);
$c = new Comment();
$c->setId($d->id);
$c->setBody($d->body);
//$c->setPost($pm->findPostById($d->postID));
$c->setUser($um->findUserById($d->userID));
$c->setPublicationDate($d->publicationDate);
$data[] = $c;
$stmt->closeCursor();
return $data;
}
示例5: recherche
public function recherche($marecherche)
{
$requete = $this->_db->prepare('select c.comment_id , c.comment , c.note , a.nom , u.first_name , u.name from commentaire c inner join utilisateur u on u.id=c.profile_id inner join article a on a.id=c.article_id where a.nom like "%":search"%";');
$requete->execute(array(':search' => $marecherche));
$results = $requete->fetchAll();
$tabresult = array();
if (empty($results)) {
/** Si pas de resultat alors faux */
return false;
} else {
/** Sinon parcours et stocke dans un tableau les commentaires */
foreach ($results as $result) {
$moncommentaire = new Comment();
$moncommentaire->setId($result['comment_id'])->setPid($result['first_name'] . " " . $result['name'])->setComment($result['comment'])->setNote($result['note'])->setArticleid($result['nom']);
array_push($tabresult, $moncommentaire);
// Push l'objet $article dans le tableau $tabobject
}
}
return $tabresult;
}
示例6: getMedia
/**
* @param array $data
* @return Media
*/
public function getMedia($data = array())
{
$media = new Media();
$media->setId($data["id"])->setLink($data["link"])->setCaptionText(isset($data["caption"]) && isset($data["caption"]["text"]) ? $data["caption"]["text"] : "");
if ($data["type"] == "image") {
$media->setType(Media::TYPE_IMAGE);
$media->setSource($data["images"]["standard_resolution"]["url"]);
} elseif ($data["type"] == "video") {
$media->setType(Media::TYPE_VIDEO);
$media->setSource($data["videos"]["standard_resolution"]["url"]);
}
$media->setUser($this->getUserInfo($data["user"]));
if (intval($data["comments"]["count"]) > 0) {
foreach ($data["comments"]["data"] as $comment) {
$createdAt = new \DateTime();
$createdAt->setTimestamp(intval($comment["created_time"]));
$commentObj = new Comment();
$commentObj->setId($comment["id"])->setCreatedAt($createdAt)->setText($comment["text"]);
$media->addComment($commentObj);
}
}
return $media;
}
示例7: getListOfTypeComment
/**
* This function queries all the comments and returns them in an
* autocomplete
* array if needed.
*
* @access public
* @author k
* @param boolean $parameters['forAutocompletion']
* Do we prepare the array
* for the autocompletion mechanism?
* @param integer $parameters['idParent']
* the ID of the page the
* list of page news we want
* @return int[] <code>NULL</code>, if there are no order person available
* or
* the query is erroneous or the array with keys
*/
public static function getListOfTypeComment($parameters)
{
$structuredKeys = array();
$keys = array();
$values = array();
foreach (Comment::$rawComments as $id => $array) {
if (isset($parameters['idParent']) && $array['idPost'] === $parameters['idParent']) {
$object = new Comment();
$object->setId($id);
$object->setCompleteComment();
$keys[] = $id;
$title = $id;
$structuredKeys[$id] = array('id' => $id, 'object' => $object, 'title' => $title);
$values[] = $title;
}
}
if (isset($parameters['forAutocompletion']) && $parameters['forAutocompletion']) {
$a[] = $values;
$a[] = $keys;
return $a;
} else {
return $structuredKeys;
}
}
示例8: Comment
/**
* Creates and returns a submission comment object from a row
* @param $row array
* @return Comment object
*/
function &_returnCommentFromRow($row, $childLevels = 0)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$comment = new Comment();
$comment->setId($row['comment_id']);
$comment->setSubmissionId($row['submission_id']);
$comment->setUser($userDao->getUser($row['user_id']), true);
$comment->setPosterIP($row['poster_ip']);
$comment->setPosterName($row['poster_name']);
$comment->setPosterEmail($row['poster_email']);
$comment->setTitle($row['title']);
$comment->setBody($row['body']);
$comment->setDatePosted($this->datetimeFromDB($row['date_posted']));
$comment->setDateModified($this->datetimeFromDB($row['date_modified']));
$comment->setParentCommentId($row['parent_comment_id']);
$comment->setChildCommentCount($row['num_children']);
if (!HookRegistry::call('CommentDAO::_returnCommentFromRow', array(&$comment, &$row, &$childLevels))) {
if ($childLevels > 0) {
$comment->setChildren($this->getCommentsByParentId($row['comment_id'], $childLevels - 1));
} else {
if ($childLevels == SUBMISSION_COMMENT_RECURSE_ALL) {
$comment->setChildren($this->getCommentsByParentId($row['comment_id'], SUBMISSION_COMMENT_RECURSE_ALL));
}
}
}
return $comment;
}
示例9: getComment
public function getComment($selectResult)
{
$comment = new Comment();
while ($list = mysqli_fetch_assoc($selectResult)) {
$comment->setId($list['com_comment_id']);
$comment->setText($list['com_text']);
$comment->setRatingId($list['com_rating_id']);
$comment->setCreatedBy($list['com_created_by']);
$comment->setEntryId($list['com_entry_id']);
}
//end while
return $comment;
}
示例10: loadComments
public function loadComments($survey, $arrayComments){
/* TODO START */
/* TODO END */
$comments = array();
for($i=0; $i < count($arrayComments) ; $i++ ){
$comment = new Comment($arrayComments[$i]['id_survey'],$arrayComments[$i]['message'],$arrayComments[$i]['owner']);
$comment->setId($arrayComments[$i]['ID']);
$comment->setDate($arrayComments[$i]['date']);
$comments[] = $comment;
}
return $comments;
}