original_string: protected function set_related($record) {
          $comp = $record->createdcomp;
          if ($record->relatedidnumbers) {
              $allidnumbers = explode(',', $record->relatedidnumbers);
              foreach ($allidnumbers as $rawidnumber) {
                  $idnumber = str_replace('%2C', ',', $rawidnumber);
  
                  if (isset($this->flat[$idnumber])) {
                      $relatedcomp = $this->flat[$idnumber]->createdcomp;
                      api::add_related_competency($comp->get('id'), $relatedcomp->get('id'));
                  }
              }
          }
          foreach ($record->children as $child) {
              $this->set_related($child);
          }
      }
code: protected function set_related($record) {
          $comp = $record->createdcomp;
          if ($record->relatedidnumbers) {
              $allidnumbers = explode(',', $record->relatedidnumbers);
              foreach ($allidnumbers as $rawidnumber) {
                  $idnumber = str_replace('%2C', ',', $rawidnumber);
  
                  if (isset($this->flat[$idnumber])) {
                      $relatedcomp = $this->flat[$idnumber]->createdcomp;
                      api::add_related_competency($comp->get('id'), $relatedcomp->get('id'));
                  }
              }
          }
          foreach ($record->children as $child) {
              $this->set_related($child);
          }
      }
code_tokens: protected function set_related ( $ record ) { $ comp = $ record -> createdcomp ; if ( $ record -> relatedidnumbers ) { $ allidnumbers = explode ( ',' , $ record -> relatedidnumbers ) ; foreach ( $ allidnumbers as $ rawidnumber ) { $ idnumber = str_replace ( '%2C' , ',' , $ rawidnumber ) ; if ( isset ( $ this -> flat [ $ idnumber ] ) ) { $ relatedcomp = $ this -> flat [ $ idnumber ] -> createdcomp ; api :: add_related_competency ( $ comp -> get ( 'id' ) , $ relatedcomp -> get ( 'id' ) ) ; } } } foreach ( $ record -> children as $ child ) { $ this -> set_related ( $ child ) ; } }
docstring: Walk through the idnumbers in the relatedidnumbers col and set the relations.
  @param stdClass $record
docstring_tokens: Walk through the idnumbers in the relatedidnumbers col and set the relations .