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