Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292436

JoinPluginBase::buildExtra breaks when left_field is a formula

$
0
0

Problem/Motivation

If the left_field is a formula then the left_table should be null. Here's the corresponsing fragment from the JoinPluginBase:

if ($this->leftTable) {
  $left_table = $view_query->getTableInfo($this->leftTable);
  $left_field = "$left_table[alias].$this->leftField";
}
else {
  // This can be used if left_field is a formula or something. It should be used only *very* rarely.
  $left_field = $this->leftField;
  $left_table = NULL;
}

(source)

However, the ::buildExtra method produces invalid sql in this case, e.g.

media__field_tags.langcode = .langcode

and that breaks the views query. Here's the code fragment responsible for this:

if (isset($info['left_field'])) {
  $placeholder_sql = "$left[alias].$info[left_field]";
}

(source)

Proposed resolution

Add the left table alias to the query only if the left table is set. Additionally, allow setting the left_table directly in the extra definition in case the main join's left_field is a formula but the extra's left_field is, well, a field :).

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Fixed a bug with formula handling in the extra conditions of a views join that caused problems when using the workspaces module.


Viewing all articles
Browse latest Browse all 292436

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>