Not sure if this is a bug with Language module or upstream or that but the issue occurs when attempting to save languages.

Steps to recreate
* Miminal install
* Enable comment module and don't set up any comment types
* Enable language and set up new language say en-us
* Enable content translation
* Goto http://localhost/en-us/admin/config/regional/content-language
* Hit save

The following error is shown

LogicException: Missing bundle entity, entity type comment_type, entity id comment. in Drupal\language\Entity\ContentLanguageSettings->calculateDependencies() (line 203 of core\modules\language\src\Entity\ContentLanguageSettings.php).

This is because bundle_of is not set for the comment entity and as such a none existent bundle type loaded and the depedency check fails.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Priority: Critical » Major
Issue tags: +Needs tests

Thanks

marcingy’s picture

Status: Active » Needs review
FileSize
1.42 KB

Here is a test that fails for the issue

Status: Needs review » Needs work

The last submitted patch, 2: 2444507-fatal-test.patch, failed testing.

Sutharsan’s picture

Issue tags: -Needs tests
andypost’s picture

Issue tags: +language-content
hchonov’s picture

Status: Needs work » Needs review
FileSize
2.29 KB

Fix + test.

hchonov’s picture

Issue tags: +sprint
penyaskito’s picture

+++ b/core/lib/Drupal/Core/Entity/EntityType.php
@@ -796,7 +796,7 @@ public function addConstraint($constraint_name, $options = NULL) {
-    if ($bundle_entity_type_id = $this->getBundleEntityType()) {
+    if ($bundle != $this->getProvider() && $bundle_entity_type_id = $this->getBundleEntityType()) {

AFAIK getProvider() does return the module name, and a module can provide entities with a different name than the module itself. Should we compare to entity_type_id instead?

hchonov’s picture

@penyaskito++:
Thanks! You are right of course. I missed that one....

hchonov’s picture

penyaskito’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Entity/EntityType.php
    @@ -796,7 +796,7 @@ public function addConstraint($constraint_name, $options = NULL) {
    +    if ($bundle != $this->id() && $bundle_entity_type_id = $this->getBundleEntityType()) {
    

    Nitpick: !==

  2. +++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsBundlesTest.php
    @@ -0,0 +1,41 @@
    +  /**
    +   * Tests that the settings UI saves when no bundles exist.
    +   */
    +  function testSettingsUI() {
    +    $this->drupalPostForm('admin/config/regional/content-language', array(), t('Save configuration'));
    +  }
    

    Can we at least assert the message shown when it is successfully saved?

plach’s picture

I think this is a duplicate of #1919468: EntityManager::getAllBundleInfo() adds default entity_type_id bundle for entity types with bundles, please reopen if this is not fixed in 8.0.0 and following.

Gábor Hojtsy’s picture

Issue tags: -sprint