コード例 #1
0
 /**
  * Creates a Comment object based on a DB row.
  *
  * @param array $row The DB row containing Comment data.
  * @return \GoldenTicket\Domain\Commentary
  */
 protected function buildDomainObject($row)
 {
     $comment = new Commentary();
     $comment->setNum($row['num_commentary']);
     $comment->setRate($row['rate_commentary']);
     $comment->setText($row['text_commentary']);
     //$comment->setUser($row['num_user']);
     if (array_key_exists('num_event', $row)) {
         // Find and set the associated event
         $eventId = $row['num_event'];
         $event = $this->eventDAO->find($eventId);
         $comment->setEvent($event);
     }
     if (array_key_exists('num_user', $row)) {
         // Find and set the associated event
         $userId = $row['num_user'];
         $user = $this->userDAO->find($userId);
         $comment->setUser($user);
     }
     return $comment;
 }