EntityReverse.php in CiviCRM Entity 8.3
File
src/Plugin/views/relationship/EntityReverse.php
View source
<?php
namespace Drupal\civicrm_entity\Plugin\views\relationship;
use Drupal\views\Plugin\views\relationship\EntityReverse as CoreEntityReverse;
use Drupal\views\Views;
class EntityReverse extends CoreEntityReverse {
public function query() {
$this
->ensureMyTable();
$join = [
'left_table' => $this->tableAlias,
'left_field' => $this->definition['base field'],
'table' => $this->definition['base'],
'field' => $this->definition['field_name'],
'adjusted' => TRUE,
];
if (!empty($this->options['required'])) {
$join['type'] = 'INNER';
}
if (!empty($this->definition['extra'])) {
$join['extra'] = $this->definition['extra'];
}
if (!empty($def['join_id'])) {
$id = $def['join_id'];
}
else {
$id = 'standard';
}
$join_instance = $this->joinManager
->createInstance($id, $join);
$join_instance->adjusted = TRUE;
$alias = $this->definition['field_name'] . '_' . $this->table;
$this->alias = $this->query
->addRelationship($alias, $join_instance, $this->definition['base'], $this->relationship);
}
}
Classes
Name |
Description |
EntityReverse |
A relationship handlers which reverse CiviCRM entity references. |