class TrackTotals in Acquia Content Hub 8.2
Same name in this branch
- 8.2 modules/acquia_contenthub_subscriber/src/EventSubscriber/PromoteEntityStatusTrack/TrackTotals.php \Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrack\TrackTotals
- 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
File
- modules/
acquia_contenthub_subscriber/ src/ EventSubscriber/ PromoteEntityStatusTrack/ TrackTotals.php, line 15
Namespace
Drupal\acquia_contenthub_subscriber\EventSubscriber\PromoteEntityStatusTrackView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TrackTotals:: |
protected | property | Keep track of the tracker table. | |
TrackTotals:: |
public static | function | Retrieve subscribed events. | |
TrackTotals:: |
public | function | Event Handler onPromoteEntityStatusTrackTotals. | |
TrackTotals:: |
public | function | TrackTotals constructor. |