Esempio n. 1
0
 public function add($moment_id, $tweet_id, $twitter_id, $screen_name, $tweeted_at, $text)
 {
     if (!Twitter::find()->where(['moment_id' => $moment_id])->andWhere(['tweet_id' => $tweet_id])->exists()) {
         $i = new Twitter();
         $i->moment_id = $moment_id;
         $i->tweet_id = $tweet_id;
         $i->twitter_id = $twitter_id;
         $i->screen_name = $screen_name;
         $i->tweeted_at = $tweeted_at;
         $i->text = $text;
         $i->save();
     }
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Twitter::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'moment_id' => $this->moment_id, 'tweet_id' => $this->tweet_id, 'twitter_id' => $this->twitter_id, 'tweeted_at' => $this->tweeted_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'screen_name', $this->screen_name])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'link', $this->link]);
     return $dataProvider;
 }
Esempio n. 3
0
 public function actionBrowse_twitter($id)
 {
     // browse twitter results for moment $id
     $dataProvider = new ActiveDataProvider(['query' => Twitter::find()->where(['moment_id' => $id])->orderBy('tweeted_at ASC')]);
     return $this->render('browse_twitter', ['dataProvider' => $dataProvider, 'moment_id' => $id]);
 }