当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::setId方法代码示例

本文整理汇总了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;
 }
开发者ID:einorler,项目名称:DB-namu-darbai,代码行数:32,代码来源:Tema.php

示例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());
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:15,代码来源:ModelTest.php

示例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());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:13,代码来源:CommentMapperTest.php

示例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;
 }
开发者ID:XenoX,项目名称:2web,代码行数:19,代码来源:PdoCommentManager.class.php

示例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;
 }
开发者ID:FMagnoux,项目名称:BackOfficeCatalogue,代码行数:20,代码来源:CommentManager.php

示例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;
 }
开发者ID:Cherkesov,项目名称:GFB-SocialClient,代码行数:27,代码来源:Hydrator.php

示例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;
     }
 }
开发者ID:piiskop,项目名称:pstk,代码行数:41,代码来源:Comment.php

示例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;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:32,代码来源:CommentDAO.inc.php

示例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;
 }
开发者ID:lilyfan,项目名称:Tarboz,代码行数:13,代码来源:CommentDataAccessor.php

示例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;
	}
开发者ID:amirdine,项目名称:academic-projects,代码行数:16,代码来源:Database.inc.php


注:本文中的Comment::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。