Commit 3c29af97 authored by alexpott's avatar alexpott

Issue #2322097 by plach: Enforce data tables for translatable entity types in...

Issue #2322097 by plach: Enforce data tables for translatable entity types in the SQL entity storage.
parent 38d39bc0
......@@ -170,11 +170,7 @@ public function __construct(EntityTypeInterface $entity_type, Connection $databa
$this->revisionKey = $this->entityType->getKey('revision') ?: 'revision_id';
$this->revisionTable = $this->entityType->getRevisionTable() ?: $this->entityTypeId . '_revision';
}
// @todo Remove the data table check once all entity types are using
// entity query and we have a views data controller. See:
// - https://drupal.org/node/2068325
// - https://drupal.org/node/1740492
$translatable = $this->entityType->isTranslatable() && $this->entityType->getDataTable();
$translatable = $this->entityType->isTranslatable();
if ($translatable) {
$this->dataTable = $this->entityType->getDataTable() ?: $this->entityTypeId . '_field_data';
$this->langcodeKey = $this->entityType->getKey('langcode') ?: 'langcode';
......
......@@ -202,7 +202,7 @@ public function testGetDataTable() {
$this->entityType->expects($this->once())
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(2))
$this->entityType->expects($this->exactly(1))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
......@@ -232,7 +232,7 @@ public function testGetRevisionDataTable($revision_data_table, $expected) {
$this->entityType->expects($this->once())
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(2))
$this->entityType->expects($this->exactly(1))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
$this->entityType->expects($this->once())
......@@ -602,7 +602,7 @@ public function testGetTableMappingTranslatable(array $entity_keys) {
$this->entityType->expects($this->exactly(2))
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(3))
$this->entityType->expects($this->exactly(2))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
$this->entityType->expects($this->any())
......@@ -664,7 +664,7 @@ public function testGetTableMappingTranslatableWithFields(array $entity_keys) {
$this->entityType->expects($this->exactly(2))
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(3))
$this->entityType->expects($this->exactly(2))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
$this->entityType->expects($this->any())
......@@ -729,7 +729,7 @@ public function testGetTableMappingRevisionableTranslatable(array $entity_keys)
$this->entityType->expects($this->exactly(2))
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(3))
$this->entityType->expects($this->exactly(2))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
$this->entityType->expects($this->any())
......@@ -861,7 +861,7 @@ public function testGetTableMappingRevisionableTranslatableWithFields(array $ent
$this->entityType->expects($this->exactly(2))
->method('isTranslatable')
->will($this->returnValue(TRUE));
$this->entityType->expects($this->exactly(3))
$this->entityType->expects($this->exactly(2))
->method('getDataTable')
->will($this->returnValue('entity_test_field_data'));
$this->entityType->expects($this->any())
......
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