Loading core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +8 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,14 @@ public function addField($field, $type, $langcode) { $key++; } } // If there are no additional specifiers but the field has a main // property, use that to look up the column name. elseif ($field_storage && $column) { $columns = $field_storage->getColumns(); if (isset($columns[$column])) { $sql_column = $table_mapping->getFieldColumnName($field_storage, $column); } } $table = $this->ensureEntityTable($index_prefix, $sql_column, $type, $langcode, $base_table, $entity_id_field, $entity_tables); } Loading core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +20 −3 Original line number Diff line number Diff line Loading @@ -975,7 +975,7 @@ public function testBaseFieldMultipleColumns() { 'name' => $this->randomMachineName(), 'vid' => 'tags', 'description' => [ 'value' => $this->randomString(), 'value' => 'description1', 'format' => 'format1', ], ]); Loading @@ -985,20 +985,37 @@ public function testBaseFieldMultipleColumns() { 'name' => $this->randomMachineName(), 'vid' => 'tags', 'description' => [ 'value' => $this->randomString(), 'value' => 'description2', 'format' => 'format2', ], ]); $term2->save(); // Test that the properties can be queried directly. $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description.value', 'description1') ->execute(); $this->assertCount(1, $ids); $this->assertEquals($term1->id(), reset($ids)); $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description.format', 'format1') ->execute(); $this->assertCount(1, $ids); $this->assertEquals($term1->id(), reset($ids)); // Test that the main property is queried if no property is specified. $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description', 'description1') ->execute(); $this->assertCount(1, $ids); $this->assertEqual($term1->id(), reset($ids)); $this->assertEquals($term1->id(), reset($ids)); } /** Loading Loading
core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +8 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,14 @@ public function addField($field, $type, $langcode) { $key++; } } // If there are no additional specifiers but the field has a main // property, use that to look up the column name. elseif ($field_storage && $column) { $columns = $field_storage->getColumns(); if (isset($columns[$column])) { $sql_column = $table_mapping->getFieldColumnName($field_storage, $column); } } $table = $this->ensureEntityTable($index_prefix, $sql_column, $type, $langcode, $base_table, $entity_id_field, $entity_tables); } Loading
core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +20 −3 Original line number Diff line number Diff line Loading @@ -975,7 +975,7 @@ public function testBaseFieldMultipleColumns() { 'name' => $this->randomMachineName(), 'vid' => 'tags', 'description' => [ 'value' => $this->randomString(), 'value' => 'description1', 'format' => 'format1', ], ]); Loading @@ -985,20 +985,37 @@ public function testBaseFieldMultipleColumns() { 'name' => $this->randomMachineName(), 'vid' => 'tags', 'description' => [ 'value' => $this->randomString(), 'value' => 'description2', 'format' => 'format2', ], ]); $term2->save(); // Test that the properties can be queried directly. $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description.value', 'description1') ->execute(); $this->assertCount(1, $ids); $this->assertEquals($term1->id(), reset($ids)); $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description.format', 'format1') ->execute(); $this->assertCount(1, $ids); $this->assertEquals($term1->id(), reset($ids)); // Test that the main property is queried if no property is specified. $ids = $this->container->get('entity_type.manager') ->getStorage('taxonomy_term') ->getQuery() ->condition('description', 'description1') ->execute(); $this->assertCount(1, $ids); $this->assertEqual($term1->id(), reset($ids)); $this->assertEquals($term1->id(), reset($ids)); } /** Loading