コード例 #1
0
 public function createObjectFromData($row)
 {
     /*
      *Use type juggling to ensure object style syntax will work
      */
     $row = (object) $row;
     /*
      *New comments wont have a post number or a submitted time
      */
     if (!isset($row->postNumber)) {
         $row->postNumber = null;
     }
     if (!isset($row->submittedAt)) {
         $row->submittedAt = null;
     }
     //Create a new comment_model object
     $comment = new Comment_Model();
     //Set the postnumber on the comment model
     $comment->setPostNumber($row->postNumber);
     //Set the name on the comment model
     $comment->setName($row->name);
     //Set the email on the comment model
     $comment->setEmail($row->email);
     //set the website on the comment model
     $comment->setWebsite($row->website);
     //set the comment on the comment model
     $comment->setComment($row->comment);
     //set the submittedAt on the comment model
     $comment->setSubmittedAt($row->submittedAt);
     //Return the new user object
     return $comment;
 }