public function setTopics(array $p_topics=array()) { // store the topics $allowed_topics = self::GetTopicTreeFlat(); BlogTopic::DeleteBlogTopics($this->getId()); foreach ($p_topics as $topic_id) { if (in_array($topic_id, $allowed_topics, true)) { $BlogTopic = new BlogTopic($this->m_data['blog_id'], $topic_id); $BlogTopic->create(); } } }