You are here

public function WorkflowState::calculateDependencies in Workflow 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/WorkflowState.php, line 143

Class

WorkflowState
Workflow configuration entity to persistently store configuration.

Namespace

Drupal\workflow\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();

  // We cannot use $this->getWorkflow()->getConfigDependencyName() because
  // calling $this->getWorkflow() here causes an infinite loop.

  /** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $workflow_type */
  $workflow_type = \Drupal::entityTypeManager()
    ->getDefinition('workflow_type');
  $this
    ->addDependency('config', $workflow_type
    ->getConfigPrefix() . '.' . $this
    ->getWorkflowId());
  return $this;
}