示例#1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSourceTopics()
 {
     return $this->hasMany(SourceTopic::className(), ['topic_id' => 'id'])->andFilterWhere(['NOT IN', 'scoopit_source_topic.source_id', $this->excludedNewsItems]);
 }
示例#2
0
 public function linkTopic($topicId)
 {
     $topic = Topic::findOne($topicId);
     if (!isset($topic)) {
         return false;
     }
     $out = [true, $topic];
     try {
         $model = new SourceTopic(['topic_id' => $topicId, 'source_id' => $this->id]);
         if (isset($this->topicPostProcessor)) {
             $model->postProcessor = $this->topicPostProcessor;
         }
         $out[0] = $model->save();
     } catch (\Exception $ex) {
         //  echo $ex->getMessage();
         $out[0] = false;
     }
     return $out;
 }