original_string: protected function _joinCondition($options)
      {
          $conditions = [];
          $tAlias = $this->_name;
          $sAlias = $this->getSource()->getAlias();
          $foreignKey = (array)$options['foreignKey'];
          $bindingKey = (array)$this->getBindingKey();
  
          if (count($foreignKey) !== count($bindingKey)) {
              if (empty($bindingKey)) {
                  $table = $this->getTarget()->getTable();
                  if ($this->isOwningSide($this->getSource())) {
                      $table = $this->getSource()->getTable();
                  }
                  $msg = 'The "%s" table does not define a primary key, and cannot have join conditions generated.';
                  throw new RuntimeException(sprintf($msg, $table));
              }
  
              $msg = 'Cannot match provided foreignKey for "%s", got "(%s)" but expected foreign key for "(%s)"';
              throw new RuntimeException(sprintf(
                  $msg,
                  $this->_name,
                  implode(', ', $foreignKey),
                  implode(', ', $bindingKey)
              ));
          }
  
          foreach ($foreignKey as $k => $f) {
              $field = sprintf('%s.%s', $sAlias, $bindingKey[$k]);
              $value = new IdentifierExpression(sprintf('%s.%s', $tAlias, $f));
              $conditions[$field] = $value;
          }
  
          return $conditions;
      }
code: protected function _joinCondition($options)
      {
          $conditions = [];
          $tAlias = $this->_name;
          $sAlias = $this->getSource()->getAlias();
          $foreignKey = (array)$options['foreignKey'];
          $bindingKey = (array)$this->getBindingKey();
  
          if (count($foreignKey) !== count($bindingKey)) {
              if (empty($bindingKey)) {
                  $table = $this->getTarget()->getTable();
                  if ($this->isOwningSide($this->getSource())) {
                      $table = $this->getSource()->getTable();
                  }
                  $msg = 'The "%s" table does not define a primary key, and cannot have join conditions generated.';
                  throw new RuntimeException(sprintf($msg, $table));
              }
  
              $msg = 'Cannot match provided foreignKey for "%s", got "(%s)" but expected foreign key for "(%s)"';
              throw new RuntimeException(sprintf(
                  $msg,
                  $this->_name,
                  implode(', ', $foreignKey),
                  implode(', ', $bindingKey)
              ));
          }
  
          foreach ($foreignKey as $k => $f) {
              $field = sprintf('%s.%s', $sAlias, $bindingKey[$k]);
              $value = new IdentifierExpression(sprintf('%s.%s', $tAlias, $f));
              $conditions[$field] = $value;
          }
  
          return $conditions;
      }
code_tokens: protected function _joinCondition ( $ options ) { $ conditions = [ ] ; $ tAlias = $ this -> _name ; $ sAlias = $ this -> getSource ( ) -> getAlias ( ) ; $ foreignKey = ( array ) $ options [ 'foreignKey' ] ; $ bindingKey = ( array ) $ this -> getBindingKey ( ) ; if ( count ( $ foreignKey ) !== count ( $ bindingKey ) ) { if ( empty ( $ bindingKey ) ) { $ table = $ this -> getTarget ( ) -> getTable ( ) ; if ( $ this -> isOwningSide ( $ this -> getSource ( ) ) ) { $ table = $ this -> getSource ( ) -> getTable ( ) ; } $ msg = 'The "%s" table does not define a primary key, and cannot have join conditions generated.' ; throw new RuntimeException ( sprintf ( $ msg , $ table ) ) ; } $ msg = 'Cannot match provided foreignKey for "%s", got "(%s)" but expected foreign key for "(%s)"' ; throw new RuntimeException ( sprintf ( $ msg , $ this -> _name , implode ( ', ' , $ foreignKey ) , implode ( ', ' , $ bindingKey ) ) ) ; } foreach ( $ foreignKey as $ k => $ f ) { $ field = sprintf ( '%s.%s' , $ sAlias , $ bindingKey [ $ k ] ) ; $ value = new IdentifierExpression ( sprintf ( '%s.%s' , $ tAlias , $ f ) ) ; $ conditions [ $ field ] = $ value ; } return $ conditions ; }
docstring: Returns a single or multiple conditions to be appended to the generated join
  clause for getting the results on the target table.
  
  @param array $options list of options passed to attachTo method
  @return array
  @throws \RuntimeException if the number of columns in the foreignKey do not
  match the number of columns in the source table primaryKey
docstring_tokens: Returns a single or multiple conditions to be appended to the generated join clause for getting the results on the target table .