summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlogickal2017-09-07 08:10:17 +0200
committerMateu Aguiló Bosch2017-09-07 08:10:17 +0200
commit74efb5b55807ee388236bf469fd1172af15464dc (patch)
treef249efa314189f7d6a9213f7ac5f46afa3113f77
parent79128a7ab815a8fc47b8ca735dde8960839556b6 (diff)
fix(Dependencies): JsonApiResourceConfig entities are orphaned when associated Entity Type/Bundle deleted (#2903432 by logickal)
-rw-r--r--src/Entity/JsonapiResourceConfig.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Entity/JsonapiResourceConfig.php b/src/Entity/JsonapiResourceConfig.php
index 54b829e..02b85b8 100644
--- a/src/Entity/JsonapiResourceConfig.php
+++ b/src/Entity/JsonapiResourceConfig.php
@@ -78,4 +78,14 @@ class JsonapiResourceConfig extends ConfigEntityBase {
\Drupal::service('router.builder')->setRebuildNeeded();
}
+ /**
+ * {@inheritdoc}
+ */
+ public function calculateDependencies() {
+ parent::calculateDependencies();
+ $id = explode('--',$this->id);
+ $typeManager = $this->entityTypeManager();
+ $dependency = $typeManager->getDefinition($id[0])->getBundleConfigDependency($id[1]);
+ $this->addDependency('config', $dependency['name']);
+ }
}