original_string: public function updateModeratorForOne($forumId = null)
      {
          try {
              if ((new Query())->from(Mod::tableName())->where([
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->exists()) {
                  Podium::getInstance()->db->createCommand()->delete(Mod::tableName(), [
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->execute();
              } else {
                  Podium::getInstance()->db->createCommand()->insert(Mod::tableName(), [
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->execute();
              }
              Podium::getInstance()->podiumCache->deleteElement('forum.moderators', $forumId);
              Log::info('Moderator updated', $this->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code: public function updateModeratorForOne($forumId = null)
      {
          try {
              if ((new Query())->from(Mod::tableName())->where([
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->exists()) {
                  Podium::getInstance()->db->createCommand()->delete(Mod::tableName(), [
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->execute();
              } else {
                  Podium::getInstance()->db->createCommand()->insert(Mod::tableName(), [
                      'forum_id' => $forumId,
                      'user_id' => $this->id
                  ])->execute();
              }
              Podium::getInstance()->podiumCache->deleteElement('forum.moderators', $forumId);
              Log::info('Moderator updated', $this->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code_tokens: public function updateModeratorForOne ( $ forumId = null ) { try { if ( ( new Query ( ) ) -> from ( Mod :: tableName ( ) ) -> where ( [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> exists ( ) ) { Podium :: getInstance ( ) -> db -> createCommand ( ) -> delete ( Mod :: tableName ( ) , [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> execute ( ) ; } else { Podium :: getInstance ( ) -> db -> createCommand ( ) -> insert ( Mod :: tableName ( ) , [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> execute ( ) ; } Podium :: getInstance ( ) -> podiumCache -> deleteElement ( 'forum.moderators' , $ forumId ) ; Log :: info ( 'Moderator updated' , $ this -> id , __METHOD__ ) ; return true ; } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
docstring: Updates moderator assignment for given forum.
  @param int $forumId forum ID
  @return bool
  @since 0.2
docstring_tokens: Updates moderator assignment for given forum .