original_string: protected function generateJoin(array &$fields)
      {
          $annotations = $this->annotations['class'];
          $props = $this->annotations['properties'];
          $table = '';
          foreach (['Require' => '', 'Include' => 'LEFT '] as $type => $join) {
              if (isset($annotations[$type])) {
                  foreach ($annotations[$type] as $local => $joinCond) {
                      if (is_numeric($local)) {
                          foreach ($joinCond as $local => $joinCond) {
                          }
                      }
                      // Hack to make the annotationParser recurse.
                      $joinCond = AnnotationParser::getAnnotations(
                          '/** @joinCond '.implode(', ', $joinCond).' */'
                      )['joincond'];
                      $table .= sprintf(
                          ' %1$sJOIN %2$s ON ',
                          $join,
                          $local
                      );
                      $conds = [];
                      foreach ($joinCond as $ref => $me) {
                          if ($me == '?') {
                              $conds[] = sprintf(
                                  "%s.%s = $me",
                                  $local,
                                  $ref
                              );
                          } else {
                              $conds[] = sprintf(
                                  "%s.%s = %s.%s",
                                  $local,
                                  $ref,
                                  $this->identifier,
                                  $me
                              );
                          }
                      }
                      $table .= implode(" AND ", $conds);
                  }
              }
          }
          foreach ($fields as &$field) {
              $name = str_replace("{$this->identifier}.", '', $field);
              if (isset($props[$name]['From'])) {
                  $field = sprintf(
                      '%s %s',
                      $props[$name]['From'],
                      $name
                  );
              }
          }
          return $table;
      }
code: protected function generateJoin(array &$fields)
      {
          $annotations = $this->annotations['class'];
          $props = $this->annotations['properties'];
          $table = '';
          foreach (['Require' => '', 'Include' => 'LEFT '] as $type => $join) {
              if (isset($annotations[$type])) {
                  foreach ($annotations[$type] as $local => $joinCond) {
                      if (is_numeric($local)) {
                          foreach ($joinCond as $local => $joinCond) {
                          }
                      }
                      // Hack to make the annotationParser recurse.
                      $joinCond = AnnotationParser::getAnnotations(
                          '/** @joinCond '.implode(', ', $joinCond).' */'
                      )['joincond'];
                      $table .= sprintf(
                          ' %1$sJOIN %2$s ON ',
                          $join,
                          $local
                      );
                      $conds = [];
                      foreach ($joinCond as $ref => $me) {
                          if ($me == '?') {
                              $conds[] = sprintf(
                                  "%s.%s = $me",
                                  $local,
                                  $ref
                              );
                          } else {
                              $conds[] = sprintf(
                                  "%s.%s = %s.%s",
                                  $local,
                                  $ref,
                                  $this->identifier,
                                  $me
                              );
                          }
                      }
                      $table .= implode(" AND ", $conds);
                  }
              }
          }
          foreach ($fields as &$field) {
              $name = str_replace("{$this->identifier}.", '', $field);
              if (isset($props[$name]['From'])) {
                  $field = sprintf(
                      '%s %s',
                      $props[$name]['From'],
                      $name
                  );
              }
          }
          return $table;
      }
code_tokens: protected function generateJoin ( array & $ fields ) { $ annotations = $ this -> annotations [ 'class' ] ; $ props = $ this -> annotations [ 'properties' ] ; $ table = '' ; foreach ( [ 'Require' => '' , 'Include' => 'LEFT ' ] as $ type => $ join ) { if ( isset ( $ annotations [ $ type ] ) ) { foreach ( $ annotations [ $ type ] as $ local => $ joinCond ) { if ( is_numeric ( $ local ) ) { foreach ( $ joinCond as $ local => $ joinCond ) { } } // Hack to make the annotationParser recurse. $ joinCond = AnnotationParser :: getAnnotations ( '/** @joinCond ' . implode ( ', ' , $ joinCond ) . ' */' ) [ 'joincond' ] ; $ table .= sprintf ( ' %1$sJOIN %2$s ON ' , $ join , $ local ) ; $ conds = [ ] ; foreach ( $ joinCond as $ ref => $ me ) { if ( $ me == '?' ) { $ conds [ ] = sprintf ( "%s.%s = $me" , $ local , $ ref ) ; } else { $ conds [ ] = sprintf ( "%s.%s = %s.%s" , $ local , $ ref , $ this -> identifier , $ me ) ; } } $ table .= implode ( " AND " , $ conds ) ; } } } foreach ( $ fields as & $ field ) { $ name = str_replace ( "{$this->identifier}." , '' , $ field ) ; if ( isset ( $ props [ $ name ] [ 'From' ] ) ) { $ field = sprintf ( '%s %s' , $ props [ $ name ] [ 'From' ] , $ name ) ; } } return $ table ; }
docstring: Internal helper to generate a JOIN statement.
  
  @param array $fields Array of fields to extend.
  @return string The JOIN statement to append to the query string.
docstring_tokens: Internal helper to generate a JOIN statement .