コード例 #1
0
ファイル: CommentDAO.php プロジェクト: spereira/tintamachja
 /**
  * Creates an Comment object based on a DB row.
  *
  * @param array $row The DB row containing Comment data.
  * @return \MicroCMS\Domain\Comment
  */
 protected function buildDomainObject($row)
 {
     // Find the associated article
     $reservationId = $row['NUM_RESA'];
     $reservation = $this->reservationDAO->find($reservationId);
     $comment = new Comment();
     $comment->setId($row['COM_ID']);
     $comment->setUserId($row['USER_ID']);
     $comment->setContent($row['COM_CONTENT']);
     $comment->setReservation($row['NUM_RESA']);
     return $comment;
 }
コード例 #2
0
ファイル: CommentDAO.php プロジェクト: MelaniePetit/MicroCMS
 /**
  * Creates an Comment object based on a DB row.
  *
  * @param array $row The DB row containing Comment data.
  * @return \MicroCMS\Domain\Comment
  */
 protected function buildDomainObject($row)
 {
     $comment = new Comment();
     $comment->setId($row['com_id']);
     $comment->setContent($row['com_content']);
     $comment->setAuthor($row['com_author']);
     if (array_key_exists('art_id', $row)) {
         // Find and set the associated article
         $articleId = $row['art_id'];
         $article = $this->articleDAO->find($articleId);
         $comment->setArticle($article);
     }
     return $comment;
 }