You are here

public function JsonapiResourceConfig::calculateDependencies in JSON:API Extras 8

Same name and namespace in other branches
  1. 8.3 src/Entity/JsonapiResourceConfig.php \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig::calculateDependencies()
  2. 8.2 src/Entity/JsonapiResourceConfig.php \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

src/Entity/JsonapiResourceConfig.php, line 84

Class

JsonapiResourceConfig
Defines the JSON API Resource Config entity.

Namespace

Drupal\jsonapi_extras\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();
  $id = explode('--', $this->id);
  $typeManager = $this
    ->entityTypeManager();
  $dependency = $typeManager
    ->getDefinition($id[0])
    ->getBundleConfigDependency($id[1]);
  $this
    ->addDependency($dependency['type'], $dependency['name']);
}