original_string: public function remove_associations() {
          global $DB;
  
          $associations = $DB->get_records('blog_association', array('blogid' => $this->id));
          foreach ($associations as $association) {
  
              // Trigger an association deleted event.
              $context = context::instance_by_id($association->contextid);
              $eventparam = array(
                  'objectid' => $this->id,
                  'other' => array('subject' => $this->subject, 'blogid' => $this->id),
                  'relateduserid' => $this->userid
              );
              $event = \core\event\blog_association_deleted::create($eventparam);
              $event->add_record_snapshot('blog_association', $association);
              $event->trigger();
  
              // Now remove the association.
              $DB->delete_records('blog_association', array('id' => $association->id));
          }
      }
code: public function remove_associations() {
          global $DB;
  
          $associations = $DB->get_records('blog_association', array('blogid' => $this->id));
          foreach ($associations as $association) {
  
              // Trigger an association deleted event.
              $context = context::instance_by_id($association->contextid);
              $eventparam = array(
                  'objectid' => $this->id,
                  'other' => array('subject' => $this->subject, 'blogid' => $this->id),
                  'relateduserid' => $this->userid
              );
              $event = \core\event\blog_association_deleted::create($eventparam);
              $event->add_record_snapshot('blog_association', $association);
              $event->trigger();
  
              // Now remove the association.
              $DB->delete_records('blog_association', array('id' => $association->id));
          }
      }
code_tokens: public function remove_associations ( ) { global $ DB ; $ associations = $ DB -> get_records ( 'blog_association' , array ( 'blogid' => $ this -> id ) ) ; foreach ( $ associations as $ association ) { // Trigger an association deleted event. $ context = context :: instance_by_id ( $ association -> contextid ) ; $ eventparam = array ( 'objectid' => $ this -> id , 'other' => array ( 'subject' => $ this -> subject , 'blogid' => $ this -> id ) , 'relateduserid' => $ this -> userid ) ; $ event = \ core \ event \ blog_association_deleted :: create ( $ eventparam ) ; $ event -> add_record_snapshot ( 'blog_association' , $ association ) ; $ event -> trigger ( ) ; // Now remove the association. $ DB -> delete_records ( 'blog_association' , array ( 'id' => $ association -> id ) ) ; } }
docstring: remove all associations for a blog entry
  
  @return void
docstring_tokens: remove all associations for a blog entry