示例#1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSources()
 {
     $_q = $this->hasMany(Source::className(), ['id' => 'source_id'])->via('sourceTopics');
     if (isset($this->limit)) {
         $_q->limit($this->limit);
     }
     return $_q;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSource()
 {
     return $this->hasOne(Source::className(), ['id' => 'source_id']);
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSources()
 {
     return $this->hasMany(Source::className(), ['id' => 'source_id'])->viaTable('scoopit_source_keyword', ['keyword_id' => 'id']);
 }
示例#4
0
 public static function create($item)
 {
     $model = new Source();
     $model->setPostAttributes($item);
     $model->save();
     try {
         if ($model->save()) {
             return $model;
         }
     } catch (\Exception $ex) {
     }
     return null;
 }
 public function actionDropAll()
 {
     Source::deleteAll('1=1');
 }