Commit ea24dc51 authored by alexpott's avatar alexpott

Issue #2374339 by benjy, chx: FieldConfigBase::calculateDependencies() fatal error is unhelpful

parent 21765ac4
......@@ -13,6 +13,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\TypedData\FieldItemDataDefinition;
use Drupal\Component\Utility\String;
/**
* Base class for configurable field definitions.
......@@ -248,7 +249,9 @@ public function calculateDependencies() {
// depend on the bundle entity.
$bundle_entity_type_id = $this->entityManager()->getDefinition($this->entity_type)->getBundleEntityType();
if ($bundle_entity_type_id != 'bundle') {
$bundle_entity = $this->entityManager()->getStorage($bundle_entity_type_id)->load($this->bundle);
if (!$bundle_entity = $this->entityManager()->getStorage($bundle_entity_type_id)->load($this->bundle)) {
throw new \LogicException(String::format('Missing bundle entity, entity type %type, entity id %bundle.', array('%type' => $bundle_entity_type_id, '%id' => $this->bundle)));
}
$this->addDependency('config', $bundle_entity->getConfigDependencyName());
}
return $this->dependencies;
......
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