'News ID', 'topic_id' => 'Topic ID', ]; } /** * {@inheritdoc} * @return NewsTopicRelationQuery the active query used by this AR class. */ public static function find() { return new NewsTopicRelationQuery(get_called_class()); } /** * {@inheritdoc} * @return status */ public function saveNewsTopics($id, $topics) { $status = true; foreach( $topics as $item ){ $status &= $this->db->createCommand()->insert(NewsTopicRelation::tableName(), [ 'news_id' => $id, 'topic_id' => $item, ])->execute(); } return $status; } }