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