You are here

class RePublishDependencyChanges in Acquia Content Hub 8.2

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

@package Drupal\acquia_contenthub_publisher\EventSubscriber\InvalidateDependendencies

Hierarchy

  • class \Drupal\acquia_contenthub_publisher\EventSubscriber\InvalidateDependencies\RePublishDependencyChanges implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RePublishDependencyChanges

1 string reference to 'RePublishDependencyChanges'
acquia_contenthub_publisher.services.yml in modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
1 service uses RePublishDependencyChanges
requeue_dependency_changes.cache_invalidation in modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
Drupal\acquia_contenthub_publisher\EventSubscriber\InvalidateDependencies\RePublishDependencyChanges

File

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

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\InvalidateDependencies
View source
class RePublishDependencyChanges implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[DependencyCalculatorEvents::INVALIDATE_DEPENDENCIES][] = [
      'onInvalidateDependencies',
    ];
    return $events;
  }

  /**
   * Republishes entities whose depcalc cache got invalidated.
   *
   * @param \Drupal\depcalc\Event\InvalidateDependenciesEvent $event
   *   The Depcalc Invalidate dependencies event.
   *
   * @throws \Exception
   */
  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');
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RePublishDependencyChanges::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
RePublishDependencyChanges::onInvalidateDependencies public function Republishes entities whose depcalc cache got invalidated.