Beispiel #1
0
 /**
  * @return CommentModel[]|null
  */
 public function getComments()
 {
     $commentsArray = $this->db()->select('*')->from('comments')->order(array('id' => 'DESC'))->execute()->fetchRows();
     if (empty($commentsArray)) {
         return NULL;
     }
     $comments = array();
     foreach ($commentsArray as $commentRow) {
         $commentModel = new CommentModel();
         $commentModel->setId($commentRow['id']);
         $commentModel->setFKId($commentRow['fk_id']);
         $commentModel->setKey($commentRow['key']);
         $commentModel->setText($commentRow['text']);
         $commentModel->setUserId($commentRow['user_id']);
         $commentModel->setDateCreated($commentRow['date_created']);
         $comments[] = $commentModel;
     }
     return $comments;
 }