diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index e31eab6..1154edc 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -49,7 +49,7 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI * * @var array */ - protected $entityTypeDefinitions = []; + protected $entityTypeDefinitionIds = []; /** * Creates a new typed configuration manager. @@ -169,7 +169,7 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE, $is * {@inheritdoc} */ public function getDefinitionForEntityType($entity_type_id) { - if (!isset($this->entityTypeDefinitions[$entity_type_id])) { + if (TRUE || !isset($this->entityTypeDefinitionIds[$entity_type_id])) { $id = 'undefined'; foreach ($this->getDefinitions() as $definition_id => $definition) { if (isset($definition['config_entity_type']) && $definition['config_entity_type'] === $entity_type_id) { @@ -177,9 +177,9 @@ public function getDefinitionForEntityType($entity_type_id) { break; } } - $this->entityTypeDefinitions[$entity_type_id] = $this->getDefinition($id); + $this->entityTypeDefinitionIds[$entity_type_id] = $id; } - return $this->entityTypeDefinitions[$entity_type_id]; + return $this->getDefinition($this->entityTypeDefinitionIds[$entity_type_id]); } /** @@ -187,7 +187,7 @@ public function getDefinitionForEntityType($entity_type_id) { */ public function clearCachedDefinitions() { $this->schemaStorage->reset(); - $this->entityTypeDefinitions = []; + $this->entityTypeDefinitionIds = []; parent::clearCachedDefinitions(); } diff --git a/core/tests/Drupal/Tests/Core/Config/TypedConfigManagerTest.php b/core/tests/Drupal/Tests/Core/Config/TypedConfigManagerTest.php index 5432e2a..813ed3a 100644 --- a/core/tests/Drupal/Tests/Core/Config/TypedConfigManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Config/TypedConfigManagerTest.php @@ -40,8 +40,8 @@ public function testGetDefinitionForEntityType($entity_type_id, $expected) { ->setMethods(['getDefinitions']) ->getMock(); - // Once for the initial loop and once from within getDefinition(). - $manager->expects($this->exactly(2)) + // Once for the initial loop and twice from within getDefinition(). + $manager->expects($this->exactly(3)) ->method('getDefinitions') ->willReturn($definitions);