You are here

public function KeyConfigOverride::calculateDependencies in Key 8

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/KeyConfigOverride.php, line 151

Class

KeyConfigOverride
Defines the KeyConfigOverride entity.

Namespace

Drupal\key\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();
  if ($this->config_type && $this->config_name) {
    if ($this->config_type === 'system.simple') {
      $this
        ->addDependency('config', $this->config_name);
    }
    else {
      $config = $this
        ->entityTypeManager()
        ->getStorage($this->config_type)
        ->load($this->config_name);
      $this
        ->addDependency('config', $config
        ->getConfigDependencyName());
    }
  }
  if ($this->key_id) {
    $key = $this
      ->entityTypeManager()
      ->getStorage('key')
      ->load($this->key_id);
    $this
      ->addDependency('config', $key
      ->getConfigDependencyName());
  }
  return $this;
}