diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMultiValueBasefield.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMultiValueBasefield.php index 931fb6d..c1e0939 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMultiValueBasefield.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMultiValueBasefield.php @@ -10,11 +10,11 @@ use Drupal\user\UserInterface; /** - * Defines a entity type with multivalue basefields. + * Defines an entity type with a multivalue base field. * * @ContentEntityType( * id = "entity_test_multivalue_basefield", - * label = @Translation("Entity Test with multivalue basefield"), + * label = @Translation("Entity Test with a multivalue base field"), * base_table = "entity_test_multivalue_basefield", * data_table = "entity_test_multivalue_basefield_field_data", * handlers = { diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 54eb3ca..61def5a 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -58,6 +58,8 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac protected $fieldStorageDefinitions; /** + * The entity manager. + * * @var \Drupal\Core\Entity\EntityManagerInterface */ protected $entityManager; @@ -270,12 +272,9 @@ public function getViewsData() { $table = $table_mapping->getDedicatedDataTableName($field_definition->getFieldStorageDefinition()); $data[$table]['table']['group'] = $this->entityType->getLabel(); - // : $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$table]['table']['provider'] = $this->entityType->getProvider(); - //$data[$table]['table']['join'][$is_revision ? $views_revision_base_table : $views_base_table] = [ $data[$table]['table']['join'][$views_base_table] = [ 'left_field' => $base_field, - // 'left_field' => $is_revision ? $revision_field : $base_field, 'field' => 'entity_id', 'extra' => [ ['field' => 'deleted', 'value' => 0, 'numeric' => TRUE], diff --git a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataWithMultivalueBasefieldTest.php b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataWithMultivalueBasefieldTest.php deleted file mode 100644 index 7495fcc..0000000 --- a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataWithMultivalueBasefieldTest.php +++ /dev/null @@ -1,52 +0,0 @@ -installEntitySchema('entity_test_multivalue_basefield'); - } - - public function testView() { - EntityTestMultiValueBasefield::create([ - 'name' => 'test', - ])->save(); - EntityTestMultiValueBasefield::create([ - 'name' => ['test2', 'test3'], - ])->save(); - - $view = Views::getView('test_entity_multivalue_basefield'); - $view->execute(); - $this->assertIdenticalResultset($view, [ - ['name' => ['test']], - ['name' => ['test2', 'test3']], - ], ['name' => 'name']); - } - - -} diff --git a/core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php b/core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php new file mode 100644 index 0000000..7c98a87 --- /dev/null +++ b/core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php @@ -0,0 +1,54 @@ +installEntitySchema('entity_test_multivalue_basefield'); + } + + /** + * Tests entity views with multivalue base fields. + */ + public function testView() { + EntityTestMultiValueBasefield::create([ + 'name' => 'test', + ])->save(); + EntityTestMultiValueBasefield::create([ + 'name' => ['test2', 'test3'], + ])->save(); + + $view = Views::getView('test_entity_multivalue_basefield'); + $view->execute(); + $this->assertIdenticalResultset($view, [ + ['name' => ['test']], + ['name' => ['test2', 'test3']], + ], ['name' => 'name']); + } + +}