original_string: public function add_related_badges($relatedids) {
          global $DB;
          $relatedbadges = array();
          foreach ($relatedids as $relatedid) {
              $relatedbadge = new stdClass();
              $relatedbadge->badgeid = $this->id;
              $relatedbadge->relatedbadgeid = $relatedid;
              $relatedbadges[] = $relatedbadge;
          }
          $DB->insert_records('badge_related', $relatedbadges);
      }
code: public function add_related_badges($relatedids) {
          global $DB;
          $relatedbadges = array();
          foreach ($relatedids as $relatedid) {
              $relatedbadge = new stdClass();
              $relatedbadge->badgeid = $this->id;
              $relatedbadge->relatedbadgeid = $relatedid;
              $relatedbadges[] = $relatedbadge;
          }
          $DB->insert_records('badge_related', $relatedbadges);
      }
code_tokens: public function add_related_badges ( $ relatedids ) { global $ DB ; $ relatedbadges = array ( ) ; foreach ( $ relatedids as $ relatedid ) { $ relatedbadge = new stdClass ( ) ; $ relatedbadge -> badgeid = $ this -> id ; $ relatedbadge -> relatedbadgeid = $ relatedid ; $ relatedbadges [ ] = $ relatedbadge ; } $ DB -> insert_records ( 'badge_related' , $ relatedbadges ) ; }
docstring: Add multiple related badges.
  
  @param array $relatedids Id of badges.
docstring_tokens: Add multiple related badges .