Commit ebcca481 authored by webchick's avatar webchick
Browse files

Issue #2429447 by dawehner, jhodgdon, xjm, jibran: Use data table as views base table, if available

parent 975121d4
......@@ -9,7 +9,7 @@ label: form
module: views
description: ''
tag: ''
base_table: node
base_table: node_field_data
base_field: nid
core: 8.x
display:
......
......@@ -21,7 +21,7 @@ public function getViewsData() {
$data = parent::getViewsData();
$data['block_content']['id']['field']['id'] = 'block_content';
$data['block_content_field_data']['id']['field']['id'] = 'block_content';
$data['block_content_field_data']['info']['field']['id'] = 'block_content';
$data['block_content_field_data']['info']['field']['link_to_entity default'] = TRUE;
......
......@@ -8,7 +8,7 @@ label: test_block_content_view
module: views
description: ''
tag: ''
base_table: block_content
base_table: block_content_field_data
base_field: id
core: 8.x
display:
......@@ -70,7 +70,7 @@ display:
fields:
id:
id: id
table: block_content
table: block_content_field_data
field: id
relationship: none
group_type: group
......@@ -123,7 +123,7 @@ display:
sorts:
id:
id: id
table: block_content
table: block_content_field_data
field: id
relationship: none
group_type: group
......@@ -144,7 +144,7 @@ display:
arguments:
type:
id: type
table: block_content
table: block_content_field_data
field: type
relationship: none
group_type: group
......
......@@ -8,7 +8,7 @@ label: 'Test field filters'
module: views
description: ''
tag: ''
base_table: block_content
base_table: block_content_field_data
base_field: id
core: 8.x
display:
......
......@@ -8,7 +8,7 @@ label: ''
module: views
description: ''
tag: ''
base_table: block_content
base_table: block_content_field_data
base_field: id
core: '8'
display:
......
......@@ -26,7 +26,7 @@ function comment_views_data_alter(&$data) {
continue;
}
$fields = \Drupal::service('comment.manager')->getFields($entity_type_id);
$base_table = $entity_type->getBaseTable();
$base_table = $entity_type->getDataTable() ?: $entity_type->getBaseTable();
$args = array('@entity_type' => $entity_type_id);
if ($fields) {
......
......@@ -9,7 +9,7 @@ label: 'Recent comments'
module: views
description: 'Recent comments.'
tag: default
base_table: comment
base_table: comment_field_data
base_field: cid
core: 8.x
display:
......@@ -208,7 +208,7 @@ display:
entity_field: created
cid:
id: cid
table: comment
table: comment_field_data
field: cid
relationship: none
group_type: group
......
......@@ -20,16 +20,16 @@ class CommentViewsData extends EntityViewsData {
public function getViewsData() {
$data = parent::getViewsData();
$data['comment']['table']['base']['help'] = t('Comments are responses to content.');
$data['comment']['table']['base']['access query tag'] = 'comment_access';
$data['comment_field_data']['table']['base']['help'] = t('Comments are responses to content.');
$data['comment_field_data']['table']['base']['access query tag'] = 'comment_access';
$data['comment']['table']['wizard_id'] = 'comment';
$data['comment_field_data']['table']['wizard_id'] = 'comment';
$data['comment_field_data']['subject']['title'] = t('Title');
$data['comment_field_data']['subject']['help'] = t('The title of the comment.');
$data['comment_field_data']['subject']['field']['id'] = 'comment';
$data['comment']['cid']['field']['id'] = 'comment';
$data['comment_field_data']['cid']['field']['id'] = 'comment';
$data['comment_field_data']['name']['title'] = t('Author');
$data['comment_field_data']['name']['help'] = t("The name of the comment's author. Can be rendered as a link to the author's homepage.");
......@@ -190,7 +190,7 @@ public function getViewsData() {
'relationship' => array(
'title' => $entity_type->getLabel(),
'help' => t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_type->getLabel())),
'base' => $entity_type->getBaseTable(),
'base' => $entity_type->getDataTable() ?: $entity_type->getBaseTable(),
'base field' => $entity_type->getKey('id'),
'relationship field' => 'entity_id',
'id' => 'standard',
......@@ -245,7 +245,7 @@ public function getViewsData() {
// {comment_entity_statistics} for each field as multiple joins between
// the same two tables is not supported.
if (\Drupal::service('comment.manager')->getFields($type)) {
$data['comment_entity_statistics']['table']['join'][$entity_type->getBaseTable()] = array(
$data['comment_entity_statistics']['table']['join'][$entity_type->getDataTable() ?: $entity_type->getBaseTable()] = array(
'type' => 'INNER',
'left_field' => $entity_type->getKey('id'),
'field' => 'entity_id',
......
......@@ -86,7 +86,7 @@ public function query($group_by = FALSE) {
$this->ensureMyTable();
// Use the table definition to correctly add this user ID condition.
if ($this->table != 'comment') {
if ($this->table != 'comment_field_data') {
$subselect = $this->database->select('comment_field_data', 'c');
$subselect->addField('c', 'cid');
$subselect->condition('c.uid', $this->argument);
......
......@@ -20,7 +20,7 @@ class StatisticsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensureTable('node', $this->relationship);
$this->node_table = $this->query->ensureTable('node_field_data', $this->relationship);
$this->field_alias = $this->query->addField(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field);
}
......
......@@ -18,7 +18,7 @@
* help = @Translation("Display the comment as RSS."),
* theme = "views_view_row_rss",
* register_theme = FALSE,
* base = {"comment"},
* base = {"comment_field_data"},
* display_types = {"feed"}
* )
*/
......@@ -27,7 +27,7 @@ class Rss extends RssPluginBase {
/**
* {@inheritdoc}
*/
protected $base_table = 'comment';
protected $base_table = 'comment_field_data';
/**
* {@inheritdoc}
......
......@@ -19,7 +19,7 @@
*
* @ViewsWizard(
* id = "comment",
* base_table = "comment",
* base_table = "comment_field_data",
* title = @Translation("Comments")
* )
*/
......
......@@ -14,7 +14,7 @@ label: 'Comments by node'
module: views
description: ''
tag: ''
base_table: comment
base_table: comment_field_data
base_field: cid
core: 8.x
display:
......
......@@ -10,7 +10,7 @@ label: test_comment_row
module: views
description: ''
tag: ''
base_table: comment
base_table: comment_field_data
base_field: cid
core: 8.x
display:
......
......@@ -10,7 +10,7 @@ label: test_comment_rss
module: views
description: ''
tag: ''
base_table: comment
base_table: comment_field_data
base_field: cid
core: 8.x
display:
......
......@@ -11,7 +11,7 @@ label: test_comment_user_uid
module: comment_test_views
description: ''
tag: default
base_table: node
base_table: node_field_data
base_field: nid
core: '8'
display:
......@@ -41,7 +41,7 @@ display:
nid:
field: nid
id: nid
table: node
table: node_field_data
plugin_id: node
entity_type: node
entity_field: nid
......
......@@ -10,7 +10,7 @@ label: 'Test field filters'
module: views
description: ''
tag: ''
base_table: comment
base_table: comment_field_data
base_field: cid
core: 8.x
display:
......
......@@ -9,7 +9,7 @@ label: People
module: views
description: ''
tag: ''
base_table: users
base_table: users_field_data
base_field: uid
core: 8.x
display:
......@@ -75,7 +75,7 @@ display:
filters:
uid_raw:
id: uid_raw
table: users
table: users_field_data
field: uid_raw
operator: '!='
value:
......
......@@ -118,7 +118,7 @@ public function testSelectionHandlerRelationship() {
$view->displayHandlers->get('default')->setOption('relationships', array(
'test_relationship' => array(
'id' => 'uid',
'table' => 'users',
'table' => 'node_field_data',
'field' => 'uid',
),
));
......@@ -127,7 +127,7 @@ public function testSelectionHandlerRelationship() {
$view->displayHandlers->get('default')->setOption('filters', array(
'uid' => array(
'id' => 'uid',
'table' => 'users',
'table' => 'users_field_data',
'field' => 'uid',
'relationship' => 'test_relationship',
)
......
......@@ -11,7 +11,7 @@ label: 'Entity reference'
module: entity_reference_test
description: ''
tag: ''
base_table: node
base_table: node_field_data
base_field: nid
core: '8'
display:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment