Skip to content
Snippets Groups Projects
Unverified Commit 0753e719 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2628130 by Krzysztof Domański, raman.b, Lendude, kishor_kolekar,...

Issue #2628130 by Krzysztof Domański, raman.b, Lendude, kishor_kolekar, cgoffin, lamp5, cmarti, alexpott, catch, andypost: SQL error on revision export from view

(cherry picked from commit 4823b803)
parent 9bc87858
No related branches found
No related tags found
6 merge requests!1286issue #3240655 by elfakhar,!1285Issue #3240655 by elfakhar Aligne the active border,!541Issue #3123070: Fix 'PSR2.Classes.PropertyDeclaration.Underscore' coding standard,!463Resolve #3205025 "Class align center for media",!386Allow multiple vocabularies in the taxonomy filter,!308Issue #3118206: Remote media does not validate provider
......@@ -68,17 +68,13 @@ public static function create(ContainerInterface $container, array $configuratio
public function titleQuery() {
$titles = [];
$results = $this->database->query('SELECT nr.vid, nr.nid, npr.title FROM {node_revision} nr WHERE nr.vid IN ( :vids[] )', [':vids[]' => $this->value])->fetchAllAssoc('vid', PDO::FETCH_ASSOC);
$nids = [];
foreach ($results as $result) {
$nids[] = $result['nid'];
}
$nodes = $this->nodeStorage->loadMultiple(array_unique($nids));
$results = $this->nodeStorage->getAggregateQuery()
->allRevisions()
->groupBy('title')
->execute();
foreach ($results as $result) {
$nodes[$result['nid']]->set('title', $result['title']);
$titles[] = $nodes[$result['nid']]->label();
$titles[] = $result['title'];
}
return $titles;
......
langcode: en
status: true
dependencies:
module:
- node
- user
id: test_node_revision_id_argument
label: test_node_revision_id_argument
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: none
options:
items_per_page: null
offset: 0
style:
type: default
row:
type: fields
fields:
title:
id: title
table: node_field_revision
field: title
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: title
plugin_id: field
filters: { }
sorts: { }
title: test_node_revision_id_argument
header: { }
footer: { }
empty: { }
relationships: { }
arguments:
vid:
id: vid
table: node_field_revision
field: vid
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
break_phrase: false
not: false
entity_type: node
entity_field: vid
plugin_id: node_vid
display_extenders: { }
filter_groups:
operator: AND
groups: { }
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: test-revision-vid-argument
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
<?php
namespace Drupal\Tests\node\Kernel\Views;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
/**
* Tests the node_vid handler.
*
* @group node
*/
class ArgumentNodeRevisionIdTest extends ViewsKernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['node', 'field', 'user', 'node_test_views'];
/**
* {@inheritdoc}
*/
public static $testViews = ['test_node_revision_id_argument'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE): void {
parent::setUp($import_test_views);
$this->installSchema('node', 'node_access');
$this->installEntitySchema('user');
$this->installEntitySchema('node');
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
}
/**
* Tests the node revision id argument via the node_vid handler.
*/
public function testNodeRevisionRelationship() {
NodeType::create(['type' => 'page', 'name' => 'page'])->save();
$node = Node::create(['type' => 'page', 'title' => 'test1', 'uid' => 1]);
$node->save();
$node->setNewRevision();
$node->setTitle('test2');
$node->save();
$view_nid = Views::getView('test_node_revision_id_argument');
$this->executeView($view_nid, [$node->getRevisionId()]);
$this->assertIdenticalResultset($view_nid, [['title' => 'test2']]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment