You are here

public function DependencyStack::getDependency in Dependency Calculation 8

Get a specific dependency from the stack.

Parameters

string $uuid: The uuid of the dependency to retrieve.

Return value

\Drupal\depcalc\DependentEntityWrapperInterface|null The dependent entity wrapper.

1 call to DependencyStack::getDependency()
DependencyStack::getDependenciesByUuid in src/DependencyStack.php
Get a specific set of dependencies.

File

src/DependencyStack.php, line 86

Class

DependencyStack
The dependencies stack.

Namespace

Drupal\depcalc

Code

public function getDependency($uuid) {
  if (!empty($this->dependencies[$uuid])) {
    return $this->dependencies[$uuid];
  }
  if (!$this->ignoreCache) {

    // Check cached dependencies.
    $cache = \Drupal::cache('depcalc')
      ->get($uuid);
    if ($cache && $cache->expire === "-1" && $cache->data instanceof DependentEntityWrapperInterface) {
      $this->dependencies[$uuid] = $cache->data;
      return $this->dependencies[$uuid];
    }
  }
  return NULL;
}