Пример #1
0
 public static function getByIdTop($idTop)
 {
     $rows = DaoCore::find('*', self::$global_view, ['idTop' => $idTop], '', ' = ');
     $topics = array();
     foreach ($rows as $row) {
         $categorie = new CategorieModel();
         $categorie->hydrate($row);
         $topic = new TopicModel();
         $topic->hydrate($row);
         $topic->setCategorie($categorie);
         array_push($topics, $topic);
     }
     return $topics[0];
 }
Пример #2
0
 public function getPostsByTopicId($id)
 {
     $sql = 'SELECT *
                        FROM `[prefix]_forum_topics`
                        WHERE id = ' . $id;
     $fileRow = $this->db()->queryRow($sql);
     $entryModel = new TopicModel();
     $entryModel->setId($fileRow['id']);
     $entryModel->setTopicTitle($fileRow['topic_title']);
     $entryModel->setText($fileRow['text']);
     $entryModel->setCreatorId($fileRow['creator_id']);
     $entryModel->setCreatorName($fileRow['creator_name']);
     $entryModel->setDateCreated($fileRow['date_created']);
     return $entryModel;
 }