original_string: public function podiumEdit()
      {
          $transaction = static::getDb()->beginTransaction();
          try {
              if (!$this->save()) {
                  throw new Exception('Poll saving error!');
              }
  
              foreach ($this->editAnswers as $answer) {
                  foreach ($this->answers as $oldAnswer) {
                      if ($answer == $oldAnswer->answer) {
                          continue(2);
                      }
                  }
                  $pollAnswer = new PollAnswer();
                  $pollAnswer->poll_id = $this->id;
                  $pollAnswer->answer = $answer;
                  if (!$pollAnswer->save()) {
                      throw new Exception('Poll Answer saving error!');
                  }
              }
              foreach ($this->answers as $oldAnswer) {
                  foreach ($this->editAnswers as $answer) {
                      if ($answer == $oldAnswer->answer) {
                          continue(2);
                      }
                  }
                  if (!$oldAnswer->delete()) {
                      throw new Exception('Poll Answer deleting error!');
                  }
              }
  
              $transaction->commit();
              Log::info('Poll updated', $this->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              $transaction->rollBack();
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code: public function podiumEdit()
      {
          $transaction = static::getDb()->beginTransaction();
          try {
              if (!$this->save()) {
                  throw new Exception('Poll saving error!');
              }
  
              foreach ($this->editAnswers as $answer) {
                  foreach ($this->answers as $oldAnswer) {
                      if ($answer == $oldAnswer->answer) {
                          continue(2);
                      }
                  }
                  $pollAnswer = new PollAnswer();
                  $pollAnswer->poll_id = $this->id;
                  $pollAnswer->answer = $answer;
                  if (!$pollAnswer->save()) {
                      throw new Exception('Poll Answer saving error!');
                  }
              }
              foreach ($this->answers as $oldAnswer) {
                  foreach ($this->editAnswers as $answer) {
                      if ($answer == $oldAnswer->answer) {
                          continue(2);
                      }
                  }
                  if (!$oldAnswer->delete()) {
                      throw new Exception('Poll Answer deleting error!');
                  }
              }
  
              $transaction->commit();
              Log::info('Poll updated', $this->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              $transaction->rollBack();
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code_tokens: public function podiumEdit ( ) { $ transaction = static :: getDb ( ) -> beginTransaction ( ) ; try { if ( ! $ this -> save ( ) ) { throw new Exception ( 'Poll saving error!' ) ; } foreach ( $ this -> editAnswers as $ answer ) { foreach ( $ this -> answers as $ oldAnswer ) { if ( $ answer == $ oldAnswer -> answer ) { continue ( 2 ) ; } } $ pollAnswer = new PollAnswer ( ) ; $ pollAnswer -> poll_id = $ this -> id ; $ pollAnswer -> answer = $ answer ; if ( ! $ pollAnswer -> save ( ) ) { throw new Exception ( 'Poll Answer saving error!' ) ; } } foreach ( $ this -> answers as $ oldAnswer ) { foreach ( $ this -> editAnswers as $ answer ) { if ( $ answer == $ oldAnswer -> answer ) { continue ( 2 ) ; } } if ( ! $ oldAnswer -> delete ( ) ) { throw new Exception ( 'Poll Answer deleting error!' ) ; } } $ transaction -> commit ( ) ; Log :: info ( 'Poll updated' , $ this -> id , __METHOD__ ) ; return true ; } catch ( Exception $ e ) { $ transaction -> rollBack ( ) ; Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
docstring: Performs poll update.
  @return bool
docstring_tokens: Performs poll update .