ViewsJoin in D8 has an advertised behavior of the JoinPluginBase to permit operators other than '=' in the relationship:
# -- excerpted from core/modules/views/src/Plugin/views/join/JoinPluginBase.php
* Here are some examples of configuration for the join plugins.
*
* For this SQL:
* @code
* LEFT JOIN {two} ON one.field_a = two.field_b
* @endcode
* Use this configuration:
* @code
* $configuration = array(
* 'table' => 'two',
* 'field' => 'field_b',
* 'left_table' => 'one',
* 'left_field' => 'field_a',
* 'operator' => '=',
* );
Currently, the code uses '=' in all cases:
$condition = "$left_field = $table[alias].$this->field";
To be equivalent to the advertised behavior in D8, it should allow the relationship def to specify an operator:
$operator = !empty($this->definition['operator']) ? $this->definition['operator'] : '=';
$condition = "$left_field $operator $table[alias].$this->field";
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views-relationship-join-plugin-support-operator-definition-2845586_02.patch | 571 bytes | robertwb |
Comments
Comment #2
robertwb commentedComment #3
robertwb commentedComment #4
robertwb commentedComment #5
chris matthews commentedThe 2 year old patch in #2 to handlers.inc applied cleanly to the latest views 7.x-3.x-dev and if still relevant needs to be reviewed.
Comment #6
klonosThis patch has a coding standards violation, where there's two lines of code into one. I would re-roll it properly, but unsure if we're still doing patches or have switched to using merge requests in https://git.drupalcode.org/project/views/-/merge_requests instead (which would be most convenient TBH).
I've also seem to have lost the ability to change issue properties/metadata. Someone will need to change this to "needs work".
Comment #7
damienmckennaYou haven't lost the ability to change issue meta data, but you might have misplaced it.
Yes the patch needs to be fixed.