/** * Permet d'obtenir une instance de la class <br> * Fait partie du design pattern <b>Singleton</b> * @return Une instance de TopicDAO * @since 1.0.0 */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new TopicDAO(); } return self::$instance; }
public function bindAllTopic($forums) { if (!isset($forums)) { return null; } $topicDAO = TopicDAO::getInstance(); foreach ($forums as $forum) { $topics = $topicDAO->getAllByForum($forum->getId()); if (!$topics) { $topics = null; } $forum->setTopics($topics); } }