diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php index 2389a8f..de48ba1 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php @@ -193,6 +193,24 @@ public function addField($field, $type, $langcode) { // next one is a column of this field. if ($key < $count) { $next = $specifiers[$key + 1]; + // Is this a delta wildcard? + if ($next == '?') { + if ($key < $count) { + $key++; + $next = $specifiers[$key + 1]; + } + else { + return 0; + } + } + // Is this a delta value? + if (is_numeric($next)) { + if ($next > 0) { + $this->sqlQuery->condition('1 <> 1'); + } + $key++; + $next = $specifiers[$key + 1]; + } // Is this a field column? $columns = $field_storage->getColumns(); if (isset($columns[$next]) || in_array($next, $table_mapping->getReservedColumns())) { diff --git a/core/modules/system/src/Tests/Entity/EntityQueryTest.php b/core/modules/system/src/Tests/Entity/EntityQueryTest.php index 824094f..c29f8a5 100644 --- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php @@ -538,7 +538,7 @@ public function testDelta() { // Test '?' wildcard $this->queryResults = $this->factory->get('entity_test_mulrev') - ->condition("$figures.?.color", array('blue', 'red')) + ->condition("$figures.?.color", array('blue', 'red'), 'IN') ->condition("$figures.?", array(0, 1), 'IN') ->sort('id') ->execute();