You are here

public function CalculateEntityDependenciesEvent::addDependency in Dependency Calculation 8

Add a dependency to this wrapper.

Parameters

\Drupal\depcalc\DependentEntityWrapperInterface $dependency: The dependency to be added.

1 call to CalculateEntityDependenciesEvent::addDependency()
CalculateEntityDependenciesEvent::setDependencies in src/Event/CalculateEntityDependenciesEvent.php
Add a group of dependencies to this wrapper.

File

src/Event/CalculateEntityDependenciesEvent.php, line 77

Class

CalculateEntityDependenciesEvent
The event dispatched to calculate dependencies.

Namespace

Drupal\depcalc\Event

Code

public function addDependency(DependentEntityWrapperInterface $dependency) {
  $dependencies = $this
    ->getWrapper()
    ->getDependencies();
  if (!array_key_exists($dependency
    ->getUuid(), $dependencies)) {
    $this
      ->getWrapper()
      ->addDependency($dependency, $this
      ->getStack());
  }
}