original_string: protected function join($row)
      {
          $keys['local']   = $this->keys['local'];
          $keys['foreign'] = $this->keys['foreign'];
  
          if ($this->relationType == 'hasAndBelongsToMany')
          {
              $join = Database::table($this->getJunction())
                      ->groupBy($this->tables['local'] . '_id')
                      ->where($this->tables['local'] . '_id', '=', $row->{$keys['local']})
                      ->findAll()
                      ->asArray(null, $this->tables['foreign'] . '_id');
  
  
              if (empty($join))
                  return [];
  
              return Database::table($this->tables['foreign'])
                              ->where($keys['foreign'], 'IN', $join[$row->{$keys['local']}]);
          }
  
          return Database::table($this->tables['foreign'])
                          ->where($keys['foreign'], '=', $row->{$keys['local']});
      }
code: protected function join($row)
      {
          $keys['local']   = $this->keys['local'];
          $keys['foreign'] = $this->keys['foreign'];
  
          if ($this->relationType == 'hasAndBelongsToMany')
          {
              $join = Database::table($this->getJunction())
                      ->groupBy($this->tables['local'] . '_id')
                      ->where($this->tables['local'] . '_id', '=', $row->{$keys['local']})
                      ->findAll()
                      ->asArray(null, $this->tables['foreign'] . '_id');
  
  
              if (empty($join))
                  return [];
  
              return Database::table($this->tables['foreign'])
                              ->where($keys['foreign'], 'IN', $join[$row->{$keys['local']}]);
          }
  
          return Database::table($this->tables['foreign'])
                          ->where($keys['foreign'], '=', $row->{$keys['local']});
      }
code_tokens: protected function join ( $ row ) { $ keys [ 'local' ] = $ this -> keys [ 'local' ] ; $ keys [ 'foreign' ] = $ this -> keys [ 'foreign' ] ; if ( $ this -> relationType == 'hasAndBelongsToMany' ) { $ join = Database :: table ( $ this -> getJunction ( ) ) -> groupBy ( $ this -> tables [ 'local' ] . '_id' ) -> where ( $ this -> tables [ 'local' ] . '_id' , '=' , $ row -> { $ keys [ 'local' ] } ) -> findAll ( ) -> asArray ( null , $ this -> tables [ 'foreign' ] . '_id' ) ; if ( empty ( $ join ) ) return [ ] ; return Database :: table ( $ this -> tables [ 'foreign' ] ) -> where ( $ keys [ 'foreign' ] , 'IN' , $ join [ $ row -> { $ keys [ 'local' ] } ] ) ; } return Database :: table ( $ this -> tables [ 'foreign' ] ) -> where ( $ keys [ 'foreign' ] , '=' , $ row -> { $ keys [ 'local' ] } ) ; }
docstring: Process query with joined data
  @param object $row One row of data
  @return Database
docstring_tokens: Process query with joined data