original_string: public function join(
          $foreignTable,
          $leftField = null,
          $joinKind = null,
          $joinAlias = null,
          $relation = null,
          $behaviour = 'cascade'
      ) {
          list($rightTable, $rightField) = explode('.', $foreignTable, 2);
          if (is_null($rightField)) {
              $rightField = 'id';
          }
          $referenceType = ($rightField === 'id') ? 'hasOne' : 'hasMany';
          if ($referenceType === 'hasMany') {
              throw $this->exception('has many join isn\'t supported');
          }
          $leftTable = $this->table;
  
          $joinAlias = $this->_unique($this->relations, $joinAlias);
          /** @type Field_SQL_Relation $field */
          $field = $this->add($this->defaultSQLRelationFieldClass);
          $field->setLeftTable($relation ?: $leftTable)
              ->setLeftField($leftField)
              ->setRightTable($rightTable)
              ->setRightField($rightField)
              ->setJoinKind($joinKind)
              ->setJoinAlias($joinAlias)
              ->setModel($this);
  
          $field->referenceType = $referenceType;
          $field->setBehaviour($behaviour);
  
          $this->relations[$joinAlias] = $field;
  
          return $field;
      }
code: public function join(
          $foreignTable,
          $leftField = null,
          $joinKind = null,
          $joinAlias = null,
          $relation = null,
          $behaviour = 'cascade'
      ) {
          list($rightTable, $rightField) = explode('.', $foreignTable, 2);
          if (is_null($rightField)) {
              $rightField = 'id';
          }
          $referenceType = ($rightField === 'id') ? 'hasOne' : 'hasMany';
          if ($referenceType === 'hasMany') {
              throw $this->exception('has many join isn\'t supported');
          }
          $leftTable = $this->table;
  
          $joinAlias = $this->_unique($this->relations, $joinAlias);
          /** @type Field_SQL_Relation $field */
          $field = $this->add($this->defaultSQLRelationFieldClass);
          $field->setLeftTable($relation ?: $leftTable)
              ->setLeftField($leftField)
              ->setRightTable($rightTable)
              ->setRightField($rightField)
              ->setJoinKind($joinKind)
              ->setJoinAlias($joinAlias)
              ->setModel($this);
  
          $field->referenceType = $referenceType;
          $field->setBehaviour($behaviour);
  
          $this->relations[$joinAlias] = $field;
  
          return $field;
      }
code_tokens: public function join ( $ foreignTable , $ leftField = null , $ joinKind = null , $ joinAlias = null , $ relation = null , $ behaviour = 'cascade' ) { list ( $ rightTable , $ rightField ) = explode ( '.' , $ foreignTable , 2 ) ; if ( is_null ( $ rightField ) ) { $ rightField = 'id' ; } $ referenceType = ( $ rightField === 'id' ) ? 'hasOne' : 'hasMany' ; if ( $ referenceType === 'hasMany' ) { throw $ this -> exception ( 'has many join isn\'t supported' ) ; } $ leftTable = $ this -> table ; $ joinAlias = $ this -> _unique ( $ this -> relations , $ joinAlias ) ; /** @type Field_SQL_Relation $field */ $ field = $ this -> add ( $ this -> defaultSQLRelationFieldClass ) ; $ field -> setLeftTable ( $ relation ? : $ leftTable ) -> setLeftField ( $ leftField ) -> setRightTable ( $ rightTable ) -> setRightField ( $ rightField ) -> setJoinKind ( $ joinKind ) -> setJoinAlias ( $ joinAlias ) -> setModel ( $ this ) ; $ field -> referenceType = $ referenceType ; $ field -> setBehaviour ( $ behaviour ) ; $ this -> relations [ $ joinAlias ] = $ field ; return $ field ; }
docstring: See Field_SQL_Relation.
docstring_tokens: See Field_SQL_Relation .