Beispiel #1
0
 /**
  * @param TweetStructure[] $tweets
  *
  * @return bool
  * @throws \Exception
  * @throws \yii\db\Exception
  */
 public function importTweet(array $tweets)
 {
     $dbTransaction = Tweet::getDb()->beginTransaction();
     try {
         foreach ($tweets as $tweet) {
             $this->saveTweet($tweet);
         }
         $dbTransaction->commit();
         return true;
     } catch (\Exception $e) {
         $dbTransaction->rollBack();
         throw $e;
     }
 }