function ExportMetadata::addDependency
Adds a dependency on another content entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity we depend upon.
File
-
core/
lib/ Drupal/ Core/ DefaultContent/ ExportMetadata.php, line 51
Class
- ExportMetadata
- Collects metadata about an entity being exported.
Namespace
Drupal\Core\DefaultContentCode
public function addDependency(ContentEntityInterface $entity) : void {
$uuid = $entity->uuid();
if ($uuid === $this->metadata['uuid']) {
throw new \LogicException('An entity cannot depend on itself.');
}
$this->metadata['depends'][$uuid] = $entity->getEntityTypeId();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.