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 published entities in the client CDF object.

@package Drupal\acquia_contenthub_publisher\EventSubscriber\PromoteEntityStatusTrack

Hierarchy

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

Expanded class hierarchy of TrackTotals

1 string reference to 'TrackTotals'
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 TrackTotals
acquia_contenthub_publisher.promote_entity_status_tracking.tracking_totals in modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
Drupal\acquia_contenthub_publisher\EventSubscriber\PromoteEntityStatusTrack\TrackTotals

File

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

Namespace

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

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

  /**
   * TrackTotals constructor.
   *
   * @param \Drupal\acquia_contenthub_publisher\PublisherTracker $tracker
   *   Publisher tracker.
   */
  public function __construct(PublisherTracker $tracker) {
    $this->tracker = $tracker;
  }

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

  /**
   * Event Handler onPromotePublisherEntityStatusTrackTotals.
   *
   * @param \Drupal\acquia_contenthub\Event\BuildClientCdfEvent $event
   *   The build client cdf event data.
   */
  public function onPromotePublisherEntityStatusTrackTotals(BuildClientCdfEvent $event) : void {
    $cdf = $event
      ->getCdf();
    $metadata = $cdf
      ->getMetadata();
    $metadata['metrics']['publisher'] = $this->tracker
      ->getStatusMetrics($this->tracker::EXPORT_TRACKING_TABLE, 'modified');
    $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::onPromotePublisherEntityStatusTrackTotals public function Event Handler onPromotePublisherEntityStatusTrackTotals.
TrackTotals::__construct public function TrackTotals constructor.