You are here

public function RePublishDependencyChanges::onInvalidateDependencies in Acquia Content Hub 8.2

Republishes entities whose depcalc cache got invalidated.

Parameters

\Drupal\depcalc\Event\InvalidateDependenciesEvent $event: The Depcalc Invalidate dependencies event.

Throws

\Exception

File

modules/acquia_contenthub_publisher/src/EventSubscriber/InvalidateDependencies/RePublishDependencyChanges.php, line 32

Class

RePublishDependencyChanges
Re-queues for export entities whose depcalc cache got invalidated.

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\InvalidateDependencies

Code

public function onInvalidateDependencies(InvalidateDependenciesEvent $event) {

  /** @var \Drupal\depcalc\DependentEntityWrapperInterface[] $wrappers */
  $wrappers = $event
    ->getWrappers();
  foreach ($wrappers as $wrapper) {
    $entity = $wrapper
      ->getEntity();
    if ($entity) {
      _acquia_contenthub_publisher_enqueue_entity($entity, 'update');
    }
  }
}