Issue #2322097 by plach: Enforce data tables for translatable entity types in the SQL entity storage.
parent
38d39bc060
commit
3c29af9715
|
@ -170,11 +170,7 @@ class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements S
|
||||||
$this->revisionKey = $this->entityType->getKey('revision') ?: 'revision_id';
|
$this->revisionKey = $this->entityType->getKey('revision') ?: 'revision_id';
|
||||||
$this->revisionTable = $this->entityType->getRevisionTable() ?: $this->entityTypeId . '_revision';
|
$this->revisionTable = $this->entityType->getRevisionTable() ?: $this->entityTypeId . '_revision';
|
||||||
}
|
}
|
||||||
// @todo Remove the data table check once all entity types are using
|
$translatable = $this->entityType->isTranslatable();
|
||||||
// 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();
|
|
||||||
if ($translatable) {
|
if ($translatable) {
|
||||||
$this->dataTable = $this->entityType->getDataTable() ?: $this->entityTypeId . '_field_data';
|
$this->dataTable = $this->entityType->getDataTable() ?: $this->entityTypeId . '_field_data';
|
||||||
$this->langcodeKey = $this->entityType->getKey('langcode') ?: 'langcode';
|
$this->langcodeKey = $this->entityType->getKey('langcode') ?: 'langcode';
|
||||||
|
|
|
@ -202,7 +202,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->once())
|
$this->entityType->expects($this->once())
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(1))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->once())
|
$this->entityType->expects($this->once())
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(1))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
$this->entityType->expects($this->once())
|
$this->entityType->expects($this->once())
|
||||||
|
@ -602,7 +602,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(3))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
$this->entityType->expects($this->any())
|
$this->entityType->expects($this->any())
|
||||||
|
@ -664,7 +664,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(3))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
$this->entityType->expects($this->any())
|
$this->entityType->expects($this->any())
|
||||||
|
@ -729,7 +729,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(3))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
$this->entityType->expects($this->any())
|
$this->entityType->expects($this->any())
|
||||||
|
@ -861,7 +861,7 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
|
||||||
$this->entityType->expects($this->exactly(2))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('isTranslatable')
|
->method('isTranslatable')
|
||||||
->will($this->returnValue(TRUE));
|
->will($this->returnValue(TRUE));
|
||||||
$this->entityType->expects($this->exactly(3))
|
$this->entityType->expects($this->exactly(2))
|
||||||
->method('getDataTable')
|
->method('getDataTable')
|
||||||
->will($this->returnValue('entity_test_field_data'));
|
->will($this->returnValue('entity_test_field_data'));
|
||||||
$this->entityType->expects($this->any())
|
$this->entityType->expects($this->any())
|
||||||
|
|
Loading…
Reference in New Issue