You are here

public function Condition::calculateDependencies in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Entity/Condition.php \Drupal\business_rules\Entity\Condition::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides BusinessRulesItemBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

src/Entity/Condition.php, line 231

Class

Condition
Defines the Condition entity.

Namespace

Drupal\business_rules\Entity

Code

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

  /** @var \Drupal\business_rules\BusinessRulesItemObject $item */
  foreach (array_merge($this
    ->getSuccessItems(), $this
    ->getFailItems()) as $item) {
    $this
      ->addDependency('config', $item
      ->loadEntity()
      ->getConfigDependencyName());
  }
  $items = $this
    ->getSettings('items');
  if (is_array($items)) {
    foreach (BusinessRulesItemObject::itemsArrayToItemsObject($items) as $item) {
      $this
        ->addDependency('config', $item
        ->loadEntity()
        ->getConfigDependencyName());
    }
  }
  return $this;
}