You are here

class TrackTotals in Acquia Content Hub 8.2

Same name in this branch
  1. 8.2 modules/acquia_contenthub_subscriber/src/EventSubscriber/PromoteEntityStatusTrack/TrackTotals.php \Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack\TrackTotals
  2. 8.2 modules/acquia_contenthub_publisher/src/EventSubscriber/PromoteEntityStatusTrack/TrackTotals.php \Drupal\acquia_contenthub_publisher\EventSubscriber\PromoteEntityStatusTrack\TrackTotals

Class TrackTotals to track subscribed entities in the client CDF object.

@package Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack

Hierarchy

  • class \Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack\TrackTotals implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of TrackTotals

1 string reference to 'TrackTotals'
acquia_contenthub_subscriber.services.yml in modules/acquia_contenthub_subscriber/acquia_contenthub_subscriber.services.yml
modules/acquia_contenthub_subscriber/acquia_contenthub_subscriber.services.yml
1 service uses TrackTotals
acquia_contenthub_subscriber.promote_entity_status_tracking.tracking_totals in modules/acquia_contenthub_subscriber/acquia_contenthub_subscriber.services.yml
Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack\TrackTotals

File

modules/acquia_contenthub_subscriber/src/EventSubscriber/PromoteEntityStatusTrack/TrackTotals.php, line 15

Namespace

Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack
View source
class TrackTotals implements EventSubscriberInterface {

  /**
   * Keep track of the tracker table.
   *
   * @var \Drupal\acquia_contenthub_subscriber\SubscriberTracker
   */
  protected $tracker;

  /**
   * TrackTotals constructor.
   *
   * @param \Drupal\acquia_contenthub_subscriber\SubscriberTracker $tracker
   *   Subscriber tracker.
   */
  public function __construct(SubscriberTracker $tracker) {
    $this->tracker = $tracker;
  }

  /**
   * Retrieve subscribed events.
   *
   * @return array
   *   Array of subscribed events.
   */
  public static function getSubscribedEvents() : array {
    return [
      AcquiaContentHubEvents::BUILD_CLIENT_CDF => 'onPromoteEntityStatusTrackTotals',
    ];
  }

  /**
   * Event Handler onPromoteEntityStatusTrackTotals.
   *
   * @param \Drupal\acquia_contenthub\Event\BuildClientCdfEvent $event
   *   The build client cdf event data.
   */
  public function onPromoteEntityStatusTrackTotals(BuildClientCdfEvent $event) : void {
    $cdf = $event
      ->getCdf();
    $metadata = $cdf
      ->getMetadata();
    $metadata['metrics']['subscriber'] = $this->tracker
      ->getStatusMetrics($this->tracker::IMPORT_TRACKING_TABLE, 'last_imported');
    $cdf
      ->setMetadata($metadata);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TrackTotals::$tracker protected property Keep track of the tracker table.
TrackTotals::getSubscribedEvents public static function Retrieve subscribed events.
TrackTotals::onPromoteEntityStatusTrackTotals public function Event Handler onPromoteEntityStatusTrackTotals.
TrackTotals::__construct public function TrackTotals constructor.