class MissingUuid in Acquia Content Hub 8.2
Any entity that is missing its UUID shouldn't be enqueued.
@package Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility
Hierarchy
- class \Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\MissingUuid implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of MissingUuid
1 string reference to 'MissingUuid'
- 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 MissingUuid
- missing_uuid.enqueue in modules/
acquia_contenthub_publisher/ acquia_contenthub_publisher.services.yml - Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\MissingUuid
File
- modules/
acquia_contenthub_publisher/ src/ EventSubscriber/ EnqueueEligibility/ MissingUuid.php, line 15
Namespace
Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibilityView source
class MissingUuid implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ContentHubPublisherEvents::ENQUEUE_CANDIDATE_ENTITY][] = [
'onEnqueueCandidateEntity',
1000,
];
return $events;
}
/**
* Skips entities missing its UUID.
*
* @param \Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event
* The event to determine entity eligibility.
*
* @throws \Exception
*/
public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {
$entity = $event
->getEntity();
if (!Uuid::isValid($entity
->uuid())) {
$event
->setEligibility(FALSE);
$event
->stopPropagation();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MissingUuid:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
MissingUuid:: |
public | function | Skips entities missing its UUID. |