public function DependencyStack::addDependency in Dependency Calculation 8
Add a dependency to the stack.
Parameters
\Drupal\depcalc\DependentEntityWrapperInterface $dependency: The dependency to add to the stack.
bool $cache: TRUE if to add to cache (Default), FALSE otherwise.
File
- src/
DependencyStack.php, line 62
Class
- DependencyStack
- The dependencies stack.
Namespace
Drupal\depcalcCode
public function addDependency(DependentEntityWrapperInterface $dependency, $cache = true) {
if ($cache) {
\Drupal::cache('depcalc')
->set($dependency
->getUuid(), $dependency, Cache::PERMANENT, array_keys($dependency
->getDependencies()));
}
$this->dependencies[$dependency
->getRemoteUuid()] = $dependency;
if ($dependency
->needsAdditionalProcessing()) {
$this->additional_processing[$dependency
->getRemoteUuid()] = '';
}
else {
unset($this->additional_processing[$dependency
->getRemoteUuid()]);
}
}